Bug fikser med totaltid og strekktid
This commit is contained in:
parent
4048cfe94f
commit
18f49c1a0c
@ -64,14 +64,14 @@ def create_result_file(event, file_path, o_classes=[]):
|
||||
xml_child(result, 'Status', n.status)
|
||||
# <SplitTime>
|
||||
# TODO: ta utgangspunkt i løypa, ikke det brikka har stempla
|
||||
for code, split in zip(i.course.codes, n.splits):
|
||||
for code, split in zip(i.course.codes[n.fork], n.splits):
|
||||
st = ET.SubElement(result, 'SplitTime')
|
||||
xml_child(st, 'ControlCode', code)
|
||||
xml_child(st, 'Time', split)
|
||||
# </SplitTime>
|
||||
elif n.status == 'MissingPunch':
|
||||
xml_child(result, 'Status', n.status)
|
||||
for code, split in zip(i.course.codes, n.splits):
|
||||
for code, split in zip(i.course.codes[n.fork], n.splits):
|
||||
st = ET.SubElement(result, 'SplitTime')
|
||||
xml_child(st, 'ControlCode', code)
|
||||
if split != 0: xml_child(st, 'Time', split)
|
||||
@ -122,7 +122,7 @@ def runners_from_xml_entries(xml_file):
|
||||
|
||||
start_time = None
|
||||
runners.append(otime.Runner(rid, first, last, club=club_name, club_id=club_id,
|
||||
country=country,card_id=card, o_class_str=class_str,
|
||||
country=country,card_id=card, o_class=class_str,
|
||||
start_time=start_time, fee_id=fee_id))
|
||||
return runners
|
||||
|
||||
@ -201,7 +201,9 @@ def event_from_xml_entries(xml_file):
|
||||
o_classes = [otime.OClass(i, []) for i in set(class_names)]
|
||||
|
||||
runners = runners_from_xml_entries(xml_file)
|
||||
fees = fees_from_xml_entries(xml_file)
|
||||
# TODO: fiks fees
|
||||
#fees = fees_from_xml_entries(xml_file)
|
||||
fees = []
|
||||
|
||||
return otime.Event(event_id, name, organiser=organiser, runners=runners,
|
||||
fees=fees, start_time=start_time, end_time=end_time, o_classes=o_classes)
|
@ -278,19 +278,21 @@ class Event:
|
||||
runner = self.get_runner(runner_id)
|
||||
return next((i for i in produce_class_result(self, runner.o_class).runner_results if i.id == runner_id), None)
|
||||
|
||||
def get_runner_o_class(self, id):
|
||||
runner = self.get_runner(id)
|
||||
return next((copy.copy(i) for i in self.o_classes if i.name == runner.o_class), None)
|
||||
|
||||
def get_runner_time(self, id):
|
||||
runner = self.get_runner(id)
|
||||
card_dump = self.get_card_dump(runner.card_id)
|
||||
if card_dump == None:
|
||||
course = self.get_course(self.get_runner_o_class(id).course)
|
||||
if card_dump == None or course == None:
|
||||
return False
|
||||
|
||||
f_control = card_dump.controls[-1]
|
||||
f_control = course.codes[runner.fork][-1]
|
||||
# TODO: Må gjøres mer robust
|
||||
try:
|
||||
index = card_dump.controls.index(f_control)
|
||||
return card_dump.splits[index]
|
||||
except:
|
||||
return False
|
||||
index = card_dump.controls.index(f_control)
|
||||
return card_dump.splits[index]
|
||||
|
||||
def get_runner_splits(self, id):
|
||||
# Tida brukt frem til hver post, ikke tida fra forrige post
|
||||
@ -298,6 +300,7 @@ class Event:
|
||||
runner = self.get_runner(id)
|
||||
card_dump = self.get_card_dump(runner.card_id)
|
||||
course = self.get_course(self.get_o_class(runner.o_class).course)
|
||||
codes = course.codes[runner.fork]
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
@ -305,8 +308,8 @@ class Event:
|
||||
return None
|
||||
|
||||
split_iter = zip(card_dump.controls, card_dump.splits).__iter__()
|
||||
splits = [0] * len(course.codes[runner.fork])
|
||||
for n, control in enumerate(course.codes[runner.fork]):
|
||||
splits = [0] * len(codes)
|
||||
for n, control in enumerate(codes):
|
||||
if control not in card_dump.controls:
|
||||
continue
|
||||
while True:
|
||||
|
Loading…
Reference in New Issue
Block a user