From 06102ccd519a928289a1419f0cbf3083ff27e111 Mon Sep 17 00:00:00 2001 From: Sergei Kobelev Date: Thu, 28 Dec 2023 16:28:21 +0500 Subject: [PATCH] Ignore punches before start (for people who like to test start gates and my favorite triathlon organizers, who deliver activated SIACs through start/controls/finish) (#425) --- languages/ru_RU/LC_MESSAGES/sportorg.po | 4 ++-- sportorg/gui/dialogs/timekeeping_properties.py | 16 ++++++++-------- sportorg/models/memory.py | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/languages/ru_RU/LC_MESSAGES/sportorg.po b/languages/ru_RU/LC_MESSAGES/sportorg.po index a790b5db..b2c55a81 100644 --- a/languages/ru_RU/LC_MESSAGES/sportorg.po +++ b/languages/ru_RU/LC_MESSAGES/sportorg.po @@ -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 "НЕ СТАРТ." diff --git a/sportorg/gui/dialogs/timekeeping_properties.py b/sportorg/gui/dialogs/timekeeping_properties.py index 6fa5fcc1..eedb3bca 100644 --- a/sportorg/gui/dialogs/timekeeping_properties.py +++ b/sportorg/gui/dialogs/timekeeping_properties.py @@ -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) @@ -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( @@ -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 @@ -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() @@ -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' diff --git a/sportorg/models/memory.py b/sportorg/models/memory.py index cd35c48b..b4a41e18 100644 --- a/sportorg/models/memory.py +++ b/sportorg/models/memory.py @@ -999,6 +999,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 @@ -1016,9 +1017,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 @@ -1789,10 +1799,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()