Player awards are never recalculated #422

Closed
opened 2026-08-25 09:18:20 +02:00 by johnsturgeon · 0 comments
Owner

What's wrong

update_all_awards() (app/jobs/award_update_all.py:100) has no callers.
Nothing schedules it and nothing invokes it, so no award is being recalculated
and no award notification is reaching Discord.

Production confirms it. On the last deploy APScheduler found the one remaining
update_awards row in its jobstore pointing at a function that no longer
exists, and dropped it:

Unable to restore job "update_awards" -- removing it
LookupError: Error resolving reference
app.jobs.award_update_all:scheduled_update_all_awards: error looking up object

That row was the last thing that would have run it.

Impact

Perfect Week, In Your Face, Quick Pick and Won The Week stop being awarded.
send_award_notification() runs only at the tail of update_all_awards(), so
the Discord webhook goes quiet as well.

Nothing is lost permanently — every award is recomputed from picks and games
on each run, so they reappear as soon as something calls it again.

Fix

Trigger it where the underlying data actually changes:

  • On the newly_final transition in sync_scores_for_current_week.py:85,
    beside update_player_records. Every award derives from completed games, so
    a game going final is the only event that can change one mid-week.
  • A weekly cron from the dispatcher, guarded like _schedule_sync_team_records,
    as a backstop for anything the transition misses — a game that goes final
    while the app is down, say.

Done when

Awards update within a minute of a game going final, the Discord webhook fires
again, and an integrity test fails if a scheduled job reference stops
resolving.

## What's wrong `update_all_awards()` (`app/jobs/award_update_all.py:100`) has no callers. Nothing schedules it and nothing invokes it, so no award is being recalculated and no award notification is reaching Discord. Production confirms it. On the last deploy APScheduler found the one remaining `update_awards` row in its jobstore pointing at a function that no longer exists, and dropped it: ``` Unable to restore job "update_awards" -- removing it LookupError: Error resolving reference app.jobs.award_update_all:scheduled_update_all_awards: error looking up object ``` That row was the last thing that would have run it. ## Impact Perfect Week, In Your Face, Quick Pick and Won The Week stop being awarded. `send_award_notification()` runs only at the tail of `update_all_awards()`, so the Discord webhook goes quiet as well. Nothing is lost permanently — every award is recomputed from picks and games on each run, so they reappear as soon as something calls it again. ## Fix Trigger it where the underlying data actually changes: - On the `newly_final` transition in `sync_scores_for_current_week.py:85`, beside `update_player_records`. Every award derives from completed games, so a game going final is the only event that can change one mid-week. - A weekly cron from the dispatcher, guarded like `_schedule_sync_team_records`, as a backstop for anything the transition misses — a game that goes final while the app is down, say. ## Done when Awards update within a minute of a game going final, the Discord webhook fires again, and an integrity test fails if a scheduled job reference stops resolving.
johnsturgeon added reference fix-awards-never-recalculated-422 2026-08-25 09:27:53 +02:00
Sign in to join this conversation.
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
johnsturgeon/tgfp-web#422
No description provided.