Fiksa gaflinger
This commit is contained in:
parent
95f10000bb
commit
24f8c30c81
@ -38,7 +38,7 @@ def event_from_yaml_and_csv(config_path, mtr_path, csv_path):
|
||||
with open(csv_path, 'r') as f:
|
||||
data = [i.split(';') for i in f.readlines()]
|
||||
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=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.runners = runners
|
||||
return event
|
@ -172,7 +172,7 @@ def courses_from_xml(xml_file):
|
||||
controls.remove('STA1')
|
||||
controls.remove('FIN1')
|
||||
controls = [int(l) for l in controls]
|
||||
courseobjs.append(otime.Course(name, controls))
|
||||
courseobjs.append(otime.Course(name, [controls]))
|
||||
return courseobjs
|
||||
|
||||
def event_from_xml_entries(xml_file):
|
||||
|
@ -161,12 +161,11 @@ class CardDump:
|
||||
|
||||
# Stored in Event.courses
|
||||
class Course:
|
||||
def __init__(self, name, codes, forked=False, variations=None):
|
||||
def __init__(self, name, codes, forked=False):
|
||||
self.name = name
|
||||
# Codes is a list of courses
|
||||
self.codes = codes
|
||||
self.forked = forked
|
||||
# Variations is a list
|
||||
self.variations = variations
|
||||
|
||||
def __repr__(self):
|
||||
return f'name({self.name})'
|
||||
@ -270,7 +269,7 @@ class Event:
|
||||
course = self.get_course(o_class.course)
|
||||
if not self.get_card_dump(runner.card_id):
|
||||
return 'Active'
|
||||
if contains(course.codes, self.get_card_dump(runner.card_id).controls):
|
||||
if contains(course.codes[runner.fork], self.get_card_dump(runner.card_id).controls):
|
||||
return 'OK'
|
||||
else:
|
||||
return 'MissingPunch'
|
||||
@ -306,8 +305,8 @@ class Event:
|
||||
return None
|
||||
|
||||
split_iter = zip(card_dump.controls, card_dump.splits).__iter__()
|
||||
splits = [0] * len(course.codes)
|
||||
for n, control in enumerate(course.codes):
|
||||
splits = [0] * len(course.codes[runner.fork])
|
||||
for n, control in enumerate(course.codes[runner.fork]):
|
||||
if control not in card_dump.controls:
|
||||
continue
|
||||
while True:
|
||||
@ -404,7 +403,7 @@ def courses_from_ttime_conf(ttime_file):
|
||||
n = n.split(',')
|
||||
loops += 1
|
||||
n = list(map(int, n))
|
||||
courses.append(Course('course_'+str(loops), n))
|
||||
courses.append(Course('course_'+str(loops), [n]))
|
||||
return courses
|
||||
|
||||
def classes_from_ttime_conf(ttime_file, courses):
|
||||
|
Loading…
Reference in New Issue
Block a user