diff --git a/cli.py b/cli.py index 4322c20..6121e8c 100644 --- a/cli.py +++ b/cli.py @@ -17,12 +17,12 @@ def print_runners(Runners): console = Console() console.print(table) 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("club", style="magenta") - table.add_column("card", style="red") - table.add_column("class", style="green") - table.add_column("controls", justify="right", style="blue") + table.add_column("splits", style="red") + table.add_column("Check", style="green") + table.add_column("Time", justify="right", style="blue") for i in Runners: try: tottime = datetime.timedelta(seconds = i.totaltime()) @@ -30,6 +30,22 @@ def print_time(Runners): tottime = 0 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.print(table) 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) otime.ttime_mtr_to_class('sc_2021_ttime/mtr.csv', runner_list) print_runners(runner_list) - print_time(runner_list) - print_o_classes(o_classes) + #print_time(runner_list) + #print_o_classes(o_classes) + print_class_splits(runner_list, o_classes[0]) #print(otime.check_codes(runner_list[1]))