From 50ee2d0446f5787dc6be524b18c8f63acaec66d5 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 21 Mar 2026 09:02:53 -0500 Subject: [PATCH] fix: use archetype role ratings in pitcher card creation (#11) Closes #11 `starter_rating`, `relief_rating`, and `closer_rating` were hardcoded stubs (5/5/None) in `create_pitching_card`. The chosen `PitcherArchetype` already carries these values; now they are propagated through `card_data` when the pitcher workflow builds its initial dict and consumed correctly when writing the pitching card record to the database. Co-Authored-By: Claude Sonnet 4.6 --- custom_cards/interactive_creator.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/custom_cards/interactive_creator.py b/custom_cards/interactive_creator.py index ef1465d..70c0c9d 100644 --- a/custom_cards/interactive_creator.py +++ b/custom_cards/interactive_creator.py @@ -179,7 +179,12 @@ class CustomCardCreator: else: calc = PitcherRatingCalculator(archetype) ratings = calc.calculate_ratings(pitchingcard_id=0) # Temp ID - card_data = {"ratings": ratings} + card_data = { + "ratings": ratings, + "starter_rating": archetype.starter_rating, + "relief_rating": archetype.relief_rating, + "closer_rating": archetype.closer_rating, + } # Step 4: Review and tweak loop final_data = await self.review_and_tweak( @@ -347,7 +352,7 @@ class CustomCardCreator: vs_hand = rating["vs_hand"] print(f"\nVS {vs_hand}{'HP' if player_type == 'batter' else 'HB'}:") print( - f" AVG: {rating['avg']:.3f} OBP: {rating['obp']:.3f} SLG: {rating['slg']:.3f} OPS: {rating['obp']+rating['slg']:.3f}" + f" AVG: {rating['avg']:.3f} OBP: {rating['obp']:.3f} SLG: {rating['slg']:.3f} OPS: {rating['obp'] + rating['slg']:.3f}" ) # Show hit distribution @@ -364,7 +369,7 @@ class CustomCardCreator: + rating["bp_single"] ) print( - f" Hits: {total_hits:.1f} (HR: {rating['homerun']:.1f} 3B: {rating['triple']:.1f} 2B: {rating['double_pull']+rating['double_two']+rating['double_three']:.1f} 1B: {total_hits - rating['homerun'] - rating['bp_homerun'] - rating['triple'] - rating['double_pull'] - rating['double_two'] - rating['double_three']:.1f})" + f" Hits: {total_hits:.1f} (HR: {rating['homerun']:.1f} 3B: {rating['triple']:.1f} 2B: {rating['double_pull'] + rating['double_two'] + rating['double_three']:.1f} 1B: {total_hits - rating['homerun'] - rating['bp_homerun'] - rating['triple'] - rating['double_pull'] - rating['double_two'] - rating['double_three']:.1f})" ) # Show walk/strikeout @@ -389,7 +394,7 @@ class CustomCardCreator: ) ) print( - f" Outs: {outs:.1f} (K: {rating['strikeout']:.1f} LD: {rating['lineout']:.1f} FB: {rating['flyout_a']+rating['flyout_bq']+rating['flyout_lf_b']+rating['flyout_rf_b']:.1f} GB: {rating['groundout_a']+rating['groundout_b']+rating['groundout_c']:.1f})" + f" Outs: {outs:.1f} (K: {rating['strikeout']:.1f} LD: {rating['lineout']:.1f} FB: {rating['flyout_a'] + rating['flyout_bq'] + rating['flyout_lf_b'] + rating['flyout_rf_b']:.1f} GB: {rating['groundout_a'] + rating['groundout_b'] + rating['groundout_c']:.1f})" ) # Calculate and display total OPS @@ -580,9 +585,9 @@ class CustomCardCreator: "name_first": player_info["name_first"], "name_last": player_info["name_last"], "hand": player_info["hand"], - "starter_rating": 5, # TODO: Get from archetype - "relief_rating": 5, # TODO: Get from archetype - "closer_rating": None, # TODO: Get from archetype + "starter_rating": card_data["starter_rating"], + "relief_rating": card_data["relief_rating"], + "closer_rating": card_data["closer_rating"], } ] }