store: Fix: Float/Decimal type mismatch in card builders (card-creation repo)

This commit is contained in:
Cal Corum 2026-02-25 16:26:37 -06:00
parent a4cd90839e
commit 0f7c0a7e59

View File

@ -0,0 +1,12 @@
---
id: 52e4aa12-66ea-4c4b-9115-00099e4e4343
type: fix
title: "Fix: Float/Decimal type mismatch in card builders (card-creation repo)"
tags: [paper-dynasty, card-creation, card_builder, decimal, float, typeerror, type-mismatch]
importance: 0.8
confidence: 0.8
created: "2026-02-25T22:26:37.646158+00:00"
updated: "2026-02-25T22:26:37.646158+00:00"
---
## Problem\nWhen porting card builders from database (which uses Decimal throughout) to card-creation (which uses float in BattingCardRatingsModel/PitchingCardRatingsModel), all res_chances arithmetic fails. CardColumn.add_result() and FullCard.card_fill() return Decimal tuples while model fields are float, causing TypeError.\n\n## Two Required Fixes\n1. **assign_bchances()/assign_pchances()**: wrap all return values as (float(r_data[0]), float(r_data[1])) before returning\n2. **card.card_fill() call in filler loop**: r_raw = card.card_fill(play_res); r_val = (float(r_raw[0]), float(r_raw[1]))\n\n## What NOT To Do\nDo NOT try to convert res_chances to Decimal at initialization — that would require changing 50+ subtraction lines.