la til forklaring i csven

This commit is contained in:
Trygve 2023-11-28 01:33:53 +01:00
parent a39c5e4615
commit 4048cfe94f

View File

@ -22,6 +22,7 @@ def write_card_dumps(event, file_path):
def write_runners_csv(event, file_path): def write_runners_csv(event, file_path):
with open(file_path, 'w') as f: with open(file_path, 'w') as f:
f.write('ID;Status;Fornavn, Etternavn;Klasse;klubb;Brikke;Gafling;Starttid\n')
for i in event.runners: for i in event.runners:
f.write(f'{i.id};{i.status_override};{i.first}, {i.last};{i.o_class};{i.club};{i.card_id};{i.fork};{i.start_time}\n') f.write(f'{i.id};{i.status_override};{i.first}, {i.last};{i.o_class};{i.club};{i.card_id};{i.fork};{i.start_time}\n')
@ -37,6 +38,7 @@ def event_from_yaml_and_csv(config_path, mtr_path, csv_path):
with open(csv_path, 'r') as f: with open(csv_path, 'r') as f:
data = [i.split(';') for i in f.readlines()] data = [i.split(';') for i in f.readlines()]
data.pop(0)
for i in data: i[2] = i[2].split(',') for i in data: i[2] = i[2].split(',')
runners = [otime.Runner(id=i[0], status_override=i[1], first=i[2][0], last=i[2][1].strip(), o_class=i[3], club=i[4], card_id=int(i[5]), fork=int(i[6]), start_time=i[7]) for i in data] runners = [otime.Runner(id=i[0], status_override=i[1], first=i[2][0], last=i[2][1].strip(), o_class=i[3], club=i[4], card_id=int(i[5]), fork=int(i[6]), start_time=i[7]) for i in data]
event.card_dumps = card_dumps event.card_dumps = card_dumps