bro - Fix the awards data structure, and have a proper admin page for creating and managing awards #420
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web#420
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Short version: the
award_idlinkage isn't the fragile part —init_award_tableupserts by slug and updates in place, so ids are stable across restarts. Three real weaknesses, though:uq_playeraward_player_award_weekdoesn't fire for 3 of the 4 awards.game_idis in the constraint and is NULL for everything exceptin_your_face, and Postgres treats NULLs as distinct — verified:So the only thing preventing duplicate awards is the
SELECT-then-insert inupsert_award_with_args, with no backstop if two award syncs overlap.Renaming a slug orphans history. The upsert keys on
slug, so editing"in_your_face"inAWARD_DEFINITIONSinserts a newawardrow and leaves every existingPlayerAwardpointing at the old one — with no error. The slug is the identity, and it's also the field most likely to get tidied up someday.AwardSlugandAWARD_DEFINITIONSmust agree, and nothing checks. A definition whose slug isn't in the enum raisesValueErrorat startup; an enum member with no definition raisesNoResultFoundfromAward.get_by_slugduring award sync, hours later.Minor:
init_award_tablenever removes awards dropped from the definitions, andupsert_award_with_argscommits on every call rather than once per sync.Fix the awards data structure, and have a proper admin page for creating and managing awardsto bro - Fix the awards data structure, and have a proper admin page for creating and managing awardsFor posterity here is the old add_job