Begynte på resultatliste tabell

This commit is contained in:
Trygve 2022-02-10 15:02:35 +01:00
parent 83c5565063
commit 00428e7b62

29
cli.py
View File

@ -17,12 +17,12 @@ def print_runners(Runners):
console = Console() console = Console()
console.print(table) console.print(table)
def print_time(Runners): def print_time(Runners):
table = Table(title="Runners") table = Table(title="Time")
table.add_column("Name", justify="right", style="cyan", no_wrap=True) table.add_column("Name", justify="right", style="cyan", no_wrap=True)
table.add_column("club", style="magenta") table.add_column("club", style="magenta")
table.add_column("card", style="red") table.add_column("splits", style="red")
table.add_column("class", style="green") table.add_column("Check", style="green")
table.add_column("controls", justify="right", style="blue") table.add_column("Time", justify="right", style="blue")
for i in Runners: for i in Runners:
try: try:
tottime = datetime.timedelta(seconds = i.totaltime()) tottime = datetime.timedelta(seconds = i.totaltime())
@ -30,6 +30,22 @@ def print_time(Runners):
tottime = 0 tottime = 0
table.add_row(i.fullname(), i.o_class.name, str(i.splits), str(i.check_codes()), str(tottime)) table.add_row(i.fullname(), i.o_class.name, str(i.splits), str(i.check_codes()), str(tottime))
console = Console()
console.print(table)
def print_class_splits(runners, o_class):
table = Table(title=o_class.name)
table.add_column("Name", justify="right", style="cyan", no_wrap=True)
table.add_column("club", style="magenta")
table.add_column("card", style="red")
table.add_column("class", justify="right", style="green")
table.add_column("controls", justify="right", style="blue")
for i in o_class.course.codes:
table.add_column(str(i))
for i in runners:
if i.o_class == o_class:
table.add_row(i.fullname(), i.club ,str(i.card))
console = Console() console = Console()
console.print(table) console.print(table)
def print_o_classes(class_list): def print_o_classes(class_list):
@ -51,6 +67,7 @@ if __name__ == "__main__":
#runner_list = otime.xml_to_class('entries_KOK_Sommercup,_løp_2.xml', o_classes) #runner_list = otime.xml_to_class('entries_KOK_Sommercup,_løp_2.xml', o_classes)
otime.ttime_mtr_to_class('sc_2021_ttime/mtr.csv', runner_list) otime.ttime_mtr_to_class('sc_2021_ttime/mtr.csv', runner_list)
print_runners(runner_list) print_runners(runner_list)
print_time(runner_list) #print_time(runner_list)
print_o_classes(o_classes) #print_o_classes(o_classes)
print_class_splits(runner_list, o_classes[0])
#print(otime.check_codes(runner_list[1])) #print(otime.check_codes(runner_list[1]))