Begynte å porte cli.py til event modellen

This commit is contained in:
Trygve 2022-03-09 18:06:59 +01:00
parent 8888a52ff2
commit 77ea1385f9
2 changed files with 18 additions and 12 deletions

26
cli.py
View File

@ -14,10 +14,10 @@ def print_runners(Runners):
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")
table.add_column("Status", justify="right", style="blue")
for i in Runners:
table.add_row(i.fullname(), i.club ,str(i.card), i.o_class.name, str(i.controls))
table.add_row(i.fullname(), i.club ,str(i.card), i.o_class.name, i.status())
console = Console()
console.print(table)
@ -131,17 +131,19 @@ def main():
args = parser.parse_args()
if args.command == 'show_runners':
courses = otime.courses_from_ttime_conf(args.ttcnf)
o_classes = otime.classes_from_ttime_conf(args.ttcnf, courses)
runner_list = otime.ttime_db_to_class(args.ttdb, o_classes)
otime.ttime_mtr_to_class(args.mtr, runner_list)
print_runners(runner_list)
event = otime.event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.match_runners_cards()
print_runners(event.runners)
elif args.command == 'show_runner':
courses = otime.courses_from_ttime_conf(args.ttcnf)
o_classes = otime.classes_from_ttime_conf(args.ttcnf, courses)
runner_list = otime.ttime_db_to_class(args.ttdb, o_classes)
otime.ttime_mtr_to_class(args.mtr, runner_list)
for n in runner_list:
event = otime.event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.match_runners_cards()
for n in event.runners:
if args.runner == n.fullname():
inspect(n)
break

View File

@ -177,6 +177,8 @@ class card_punch:
cards = []
# hver rad er brikkenummer med tilhørende info
for row in csvreader:
if len(row) == 0:
continue
rows.append(row)
controls = []
splits = []
@ -281,6 +283,8 @@ def ttime_db_to_class(ttime_file, o_class_list=[]):
csvreader = csv.reader(open(ttime_file, 'r', encoding='latin_1'), delimiter=';',)
runnerarray = []
for row in csvreader:
if len(row) == 0:
continue
eventorid = row[0]
country = ''
name = row[2].split(',')