Fiksa strekktidsgenerering

This commit is contained in:
Trygve 2023-11-08 17:31:11 +01:00
parent bf0b400708
commit 3f4051426e
3 changed files with 4 additions and 5 deletions

View File

@ -73,6 +73,7 @@ def create_result_file(event, file_path, o_classes=[]):
for code, split in zip(i.course.codes, n.splits): for code, split in zip(i.course.codes, n.splits):
st = ET.SubElement(result, 'SplitTime') st = ET.SubElement(result, 'SplitTime')
xml_child(st, 'ControlCode', code) xml_child(st, 'ControlCode', code)
if split != 0: xml_child(st, 'Time', split)
else: else:
xml_child(result, 'Status', n.status) xml_child(result, 'Status', n.status)
else: else:

View File

@ -289,6 +289,7 @@ class Event:
return False return False
def get_runner_splits(self, id): def get_runner_splits(self, id):
# Tida brukt frem til hver post, ikke tida fra forrige post
try: try:
runner = self.get_runner(id) runner = self.get_runner(id)
card_dump = self.get_card_dump(runner.card_id) card_dump = self.get_card_dump(runner.card_id)
@ -304,17 +305,14 @@ class Event:
for n, control in enumerate(course.codes): for n, control in enumerate(course.codes):
if control not in card_dump.controls: if control not in card_dump.controls:
continue continue
split_debt = 0
while True: while True:
try: try:
punched_control, split = next(split_iter) punched_control, split = next(split_iter)
except StopIteration: except StopIteration:
break break
if punched_control == control: if punched_control == control:
splits[n] = split + split_debt splits[n] = split
break break
else:
split_debt += split
return splits return splits
def get_runner_controls(self, id): def get_runner_controls(self, id):

View File

@ -44,7 +44,7 @@ def create_split_result_list(event, file_path, o_classes=[]):
col_width = pdf.epw / 4 # distribute content evenly col_width = pdf.epw / 4 # distribute content evenly
for class_result in results: for class_result in results:
col_width = pdf.epw / (21+len(class_result.course.codes)) col_width = 10
pdf.write(txt=class_result.name) pdf.write(txt=class_result.name)
pdf.ln(line_height) pdf.ln(line_height)
for runner in class_result.runner_results: for runner in class_result.runner_results: