Skip to content

Commit

Permalink
Ignore punches before start (for people who like to test start gates …
Browse files Browse the repository at this point in the history
…and my favorite triathlon organizers, who deliver activated SIACs through start/controls/finish) (sportorg#425)
  • Loading branch information
sergeikobelev authored and Aleksandr Karpov committed Dec 29, 2023
1 parent 53679df commit ea2b514
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions languages/ru_RU/LC_MESSAGES/sportorg.po
Original file line number Diff line number Diff line change
Expand Up @@ -1533,8 +1533,8 @@ msgstr "КП из сплитов, укажите список КП"
msgid "Finish as CP"
msgstr "Использовать финиш как КП с кодом:"

msgid "Ignore readout before start"
msgstr "Игнорировать считывание до старта"
msgid "Ignore punches before start"
msgstr "Игнорировать отметки до старта"

msgid "Did not start"
msgstr "НЕ СТАРТ."
Expand Down
16 changes: 8 additions & 8 deletions sportorg/gui/dialogs/timekeeping_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ def init_ui(self):
self.assignment_mode.stateChanged.connect(self.on_assignment_mode)
self.tk_layout.addRow(self.assignment_mode)

self.ignore_readout_before_start = QCheckBox(
translate('Ignore readout before start')
self.ignore_punches_before_start = QCheckBox(
translate('Ignore punches before start')
)
self.tk_layout.addRow(self.ignore_readout_before_start)
self.tk_layout.addRow(self.ignore_punches_before_start)

self.timekeeping_tab.setLayout(self.tk_layout)

Expand Down Expand Up @@ -372,8 +372,8 @@ def set_values_from_model(self):
'system_duplicate_chip_processing', 'several_results'
)
assignment_mode = cur_race.get_setting('system_assignment_mode', False)
ignore_readout_before_start = cur_race.get_setting(
'ignore_readout_before_start', False
ignore_punches_before_start = cur_race.get_setting(
'ignore_punches_before_start', False
)
si_port = cur_race.get_setting('system_port', '')
readout_duplicate_timeout = OTime(
Expand Down Expand Up @@ -435,7 +435,7 @@ def set_values_from_model(self):

self.assignment_mode.setChecked(assignment_mode)

self.ignore_readout_before_start.setChecked(ignore_readout_before_start)
self.ignore_punches_before_start.setChecked(ignore_punches_before_start)

# result processing
obj = cur_race
Expand Down Expand Up @@ -575,7 +575,7 @@ def apply_changes_impl(self):

readout_duplicate_timeout = self.item_duplicate_timeout.getOTime().to_msec()

ignore_readout_before_start = self.ignore_readout_before_start.isChecked()
ignore_punches_before_start = self.ignore_punches_before_start.isChecked()

start_cp_number = self.item_start_cp_value.value()
finish_cp_number = self.item_finish_cp_value.value()
Expand Down Expand Up @@ -605,7 +605,7 @@ def apply_changes_impl(self):

obj.set_setting('readout_duplicate_timeout', readout_duplicate_timeout)

obj.set_setting('ignore_readout_before_start', ignore_readout_before_start)
obj.set_setting('ignore_punches_before_start', ignore_punches_before_start)

# result processing
rp_mode = 'time'
Expand Down
16 changes: 13 additions & 3 deletions sportorg/models/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ def get_course_splits(self, course=None):
return splits

def check(self, course=None):
obj = race()
if not course:
return super().check()
controls = course.controls
Expand All @@ -1035,9 +1036,18 @@ def check(self, course=None):
i.has_penalty = True
i.course_index = -1

ignore_punches_before_start = obj.get_setting(
'ignore_punches_before_start', False
)

for i in range(len(self.splits)):
try:
split = self.splits[i]

# ignore splits before start (not cleaned card or unintentional punches before start)
if ignore_punches_before_start and split.time < self.get_start_time():
continue

template = str(controls[course_index].code)
cur_code = split.code

Expand Down Expand Up @@ -1808,10 +1818,10 @@ def get_persons_by_corridor(self, corridor):
return ret

def add_new_result(self, result):
ignore_readout_before_start = self.get_setting(
'ignore_readout_before_start', False
ignore_punches_before_start = self.get_setting(
'ignore_punches_before_start', False
)
if ignore_readout_before_start:
if ignore_punches_before_start:
start = result.get_start_time()
finish = result.get_finish_time()

Expand Down

0 comments on commit ea2b514

Please sign in to comment.