Skip to content

Commit

Permalink
Bug fix to handle gaps in handicap tables being reflected in classifi…
Browse files Browse the repository at this point in the history
…cation tables to avoid loopholes.
  • Loading branch information
jatkinson1000 committed Aug 16, 2023
1 parent 683df6c commit f350238
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions archeryutils/classifications/classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,18 +1332,25 @@ def AGB_indoor_classification_scores(
# Enforce this for better code and to satisfy mypy
int_class_scores = [int(x) for x in class_scores]

# Handle possibility of max scores by checking 1 HC point above current (floored to handle 0.5)
# Handle possibility of gaps in the tables or max scores by checking 1 HC point
# above current (floored to handle 0.5) and amending accordingly
for i, (sc, hc) in enumerate(zip(int_class_scores, group_data["class_HC"])):
if sc == all_indoor_rounds[roundname].max_score():
next_score = hc_eq.score_for_round(
all_indoor_rounds[strip_spots(roundname)],
np.floor(hc) + 1,
hc_scheme,
hc_params,
round_score_up=True,
)[0]
if next_score == sc:
# if sc == all_indoor_rounds[roundname].max_score():
next_score = hc_eq.score_for_round(
all_indoor_rounds[strip_spots(roundname)],
np.floor(hc) + 1,
hc_scheme,
hc_params,
round_score_up=True,
)[0]
if next_score == sc:
# If already at max score this classification is impossible
if sc == all_indoor_rounds[roundname].max_score():
int_class_scores[i] = -9999
# If gap in table increase to next score
# (we assume here that no two classifications are only 1 point apart...)
else:
int_class_scores[i] += 1

return int_class_scores

Expand Down

0 comments on commit f350238

Please sign in to comment.