Skip to content

Commit

Permalink
feat: new features for a marked track with penalty loops (sportorg#421)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Karpov <[email protected]>
  • Loading branch information
alex-karpov and Aleksandr Karpov committed Jan 11, 2025
1 parent 4780a8d commit 65a2a52
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sportorg/models/result/result_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,24 @@ def calculate_scores_ardf(result):
return 0

return ret

@staticmethod
def marked_route_check_penalty_laps(result: Result):
obj = race()

mr_if_counting_lap = obj.get_setting('marked_route_if_counting_lap', False)
mr_if_station_check = obj.get_setting('marked_route_if_station_check', False)
mr_station_code = obj.get_setting('marked_route_penalty_lap_station_code', 0)

if mr_if_station_check and int(mr_station_code) > 0:
count_laps = 0
if mr_if_counting_lap:
count_laps = -1

for split in result.splits:
if str(split.code) == str(mr_station_code):
count_laps += 1

if count_laps < result.penalty_laps:
result.status = ResultStatus.MISSING_PUNCH
result.status_comment = 'п.п.4.6.12.7'

0 comments on commit 65a2a52

Please sign in to comment.