God pack rarity weights are computed from set-wide card counts, not per-pack counts #3

Closed
opened 2026-10-08 21:43:00 +02:00 by freydis · 0 comments
Owner

`Generation.calculate_god_pack_probabilities` weights each eligible rarity by `Card.objects.filter(set=pokemon_set, rarity=rarity).count()` over the whole set, but `prob_at_least_one_new_card` then applies those weights to the per-pack card pool. For multi-pack sets the two disagree, e.g. A1/Charizard: crown_rare weight 0.05 (set-based) vs 0.13 (pack-based), illustration_rare 0.40 vs 0.35. A god pack draws from the pack's ☆+ pool, so the per-pack count is the right one.

Impact on the displayed number is small (god packs are weighted 0.05%), but the calculation is internally inconsistent. Fix: pass the pack and count `pack.cards.filter(rarity=...)` (or derive the weights from `cards_by_rarity` already built in utils.py, which also removes the per-rarity queries).

\`Generation.calculate_god_pack_probabilities\` weights each eligible rarity by \`Card.objects.filter(set=pokemon_set, rarity=rarity).count()\` over the whole set, but \`prob_at_least_one_new_card\` then applies those weights to the per-pack card pool. For multi-pack sets the two disagree, e.g. A1/Charizard: crown_rare weight 0.05 (set-based) vs 0.13 (pack-based), illustration_rare 0.40 vs 0.35. A god pack draws from the pack's ☆+ pool, so the per-pack count is the right one. Impact on the displayed number is small (god packs are weighted 0.05%), but the calculation is internally inconsistent. Fix: pass the pack and count \`pack.cards.filter(rarity=...)\` (or derive the weights from \`cards_by_rarity\` already built in utils.py, which also removes the per-rarity queries).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
freydis/tcgp-tracker#3
No description provided.