Skip to content

Fix eligibility hours check skipping NULL has_consolidation_hours - #122

Merged
Celeo merged 1 commit into
masterfrom
fix/eligibility-null-consolidation-hours
Oct 3, 2026
Merged

Celeo merged 1 commit into
masterfrom
fix/eligibility-null-consolidation-hours

Conversation

@Celeo

@Celeo Celeo commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Controllers whose controller_eligibility_cache row has has_consolidation_hours = NULL never get controlling hours fetched, so their profile shows no hours. createRecord() inserts the row with NULL, and the hours check in controller:eligibility selects only has_consolidation_hours = false. SQL = 0 never matches NULL. The only code that sets the flag to false runs when the competency rating changes, so a row whose competency is already at target stays NULL permanently. In prod this affects 408 rows (386 non-initial-selection), e.g. CID 1446329.

Fix

  • createRecord() initializes has_consolidation_hours = false.
  • The hours-check query also matches NULL. Because of this, existing stuck rows are picked up on the next hourly run even if the migration isn't run.
  • New migration 2026_10_02_000000_backfill_null_consolidation_hours sets existing NULLs to false. Deploys don't run migrations automatically, so it has to be run by hand (php artisan migrate --path=database/migrations/2026_10_02_000000_backfill_null_consolidation_hours.php) or applied as the equivalent UPDATE.

Notes

The next hourly run after deploy will make up to ~408 additional VATSIM API v2 /stats calls (one per previously stuck row). Rows with an empty response keep the existing sleep(60) retry, so the first run may take longer than usual.

🤖 Generated with Claude Code

createRecord() left has_consolidation_hours NULL, and the hours check
selected only `= false`, so those rows never had VATSIM hours fetched
(408 rows in prod, e.g. CID 1446329). New records now start false, the
hours query also matches NULL, and a migration backfills existing rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Celeo
Celeo merged commit f12e5e5 into master Oct 3, 2026
3 checks passed
@Celeo
Celeo deleted the fix/eligibility-null-consolidation-hours branch October 3, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant