Skip to content

Commit

Permalink
Update classifications code to reflect the refactoring of handicap code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jatkinson1000 committed Feb 23, 2024
1 parent b4e9fc8 commit 798a737
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
13 changes: 5 additions & 8 deletions archeryutils/classifications/agb_indoor_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy.typing as npt

from archeryutils import load_rounds
from archeryutils.handicaps import handicap_equations as hc_eq
import archeryutils.handicaps as hc
import archeryutils.classifications.classification_utils as cls_funcs


Expand Down Expand Up @@ -281,17 +281,15 @@ def agb_indoor_classification_scores(
group_data = agb_indoor_classifications[groupname]

hc_scheme = "AGB"
hc_params = hc_eq.HcParams()

# Get scores required on this round for each classification
# Enforce full size face
class_scores = [
hc_eq.score_for_round(
hc.score_for_round(
ALL_INDOOR_ROUNDS[cls_funcs.strip_spots(roundname)],
group_data["class_HC"][i],
hc_scheme,
hc_params,
round_score_up=True,
rounded_score=True,
)
for i, class_i in enumerate(group_data["classes"])
]
Expand All @@ -305,12 +303,11 @@ def agb_indoor_classification_scores(
for i, (score, handicap) in enumerate(
zip(int_class_scores, group_data["class_HC"])
):
next_score = hc_eq.score_for_round(
next_score = hc.score_for_round(
ALL_INDOOR_ROUNDS[cls_funcs.strip_spots(roundname)],
np.floor(handicap) + 1,
hc_scheme,
hc_params,
round_score_up=True,
rounded_score=True,
)
if next_score == score:
# If already at max score this classification is impossible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import TypedDict

from archeryutils import load_rounds
from archeryutils.handicaps import handicap_equations as hc_eq
import archeryutils.handicaps as hc
import archeryutils.classifications.classification_utils as cls_funcs


Expand Down Expand Up @@ -245,16 +245,13 @@ def agb_old_indoor_classification_scores(
groupname = cls_funcs.get_groupname(bowstyle, gender, age_group)
group_data = agb_old_indoor_classifications[groupname]

hc_params = hc_eq.HcParams()

# Get scores required on this round for each classification
class_scores = [
hc_eq.score_for_round(
hc.score_for_round(
ALL_INDOOR_ROUNDS[roundname],
group_data["class_HC"][i],
"AGBold",
hc_params,
round_score_up=True,
rounded_score=True,
)
for i, class_i in enumerate(group_data["classes"])
]
Expand Down
9 changes: 3 additions & 6 deletions archeryutils/classifications/agb_outdoor_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy.typing as npt

from archeryutils import load_rounds
from archeryutils.handicaps import handicap_equations as hc_eq
import archeryutils.handicaps as hc
import archeryutils.classifications.classification_utils as cls_funcs


Expand Down Expand Up @@ -536,16 +536,13 @@ def agb_outdoor_classification_scores(
groupname = cls_funcs.get_groupname(bowstyle, gender, age_group)
group_data = agb_outdoor_classifications[groupname]

hc_params = hc_eq.HcParams()

# Get scores required on this round for each classification
class_scores = [
hc_eq.score_for_round(
hc.score_for_round(
ALL_OUTDOOR_ROUNDS[cls_funcs.strip_spots(roundname)],
group_data["class_HC"][i],
"AGB",
hc_params,
round_score_up=True,
rounded_score=True,
)
for i in range(len(group_data["classes"]))
]
Expand Down

0 comments on commit 798a737

Please sign in to comment.