Dead function gw1Fixture() in app.js hardcodes a gameweek #15

Closed
opened 2026-08-27 20:57:40 +02:00 by solvreven · 1 comment
Owner

frontend/app.js contains:

// Fixture for an ARBITRARY gameweek. gw1Fixture hard-coded "1", which was fine ...
function fixtureFor(teamId, gw) { ... t.gws[String(gw)] ... }

function gw1Fixture(teamId) {
  if (!FIXTURES) return null;
  const t = FIXTURES.teams[String(teamId)];
  return t ? (t.gws["1"] || null) : null;
}

gw1Fixture has zero callers — it was superseded by the arbitrary-gameweek
version and left behind. Harmless today, and exactly the shape that gets picked
up by the next person grepping for a fixture helper: it returns plausible data
for a gameweek that has already been played.

The same hardcoded-gameweek pattern was found in six places in /api/matches
and in resolve_market.py on 2026-08-27; this is the last known instance.

Suggested fix. Delete it.

`frontend/app.js` contains: ```js // Fixture for an ARBITRARY gameweek. gw1Fixture hard-coded "1", which was fine ... function fixtureFor(teamId, gw) { ... t.gws[String(gw)] ... } function gw1Fixture(teamId) { if (!FIXTURES) return null; const t = FIXTURES.teams[String(teamId)]; return t ? (t.gws["1"] || null) : null; } ``` `gw1Fixture` has **zero callers** — it was superseded by the arbitrary-gameweek version and left behind. Harmless today, and exactly the shape that gets picked up by the next person grepping for a fixture helper: it returns plausible data for a gameweek that has already been played. The same hardcoded-gameweek pattern was found in six places in `/api/matches` and in `resolve_market.py` on 2026-08-27; this is the last known instance. **Suggested fix.** Delete it.
Author
Owner

Deleted in 91bc231 (2026-08-29). Zero callers, confirmed by grep across
frontend/, backend/ and tests/ before removal. The surviving comment above
fixtureFor records what was removed and why, worded so it does not read as the
function returning.

One correction to this issue: it was not the last known instance. Two more
turned up this week, and both were live rather than dead:

  • FX_START = 1 in the fixtures grid — a module-level literal moved only by the
    pager, so the grid opened on GW1-6 for the rest of the season unless the user
    paged past it by hand (e433040).
  • Nine GW1 literals in index.html — three panel headings on Matches, two
    on Fixtures, a clean-sheet hint, an accuracy kicker, and two paragraphs. The
    tab printed "Match predictions · GW1" above gameweek 3's fixtures, reported by
    the user with a screenshot (281c7a9).

The second is the one worth carrying forward: every previous fix and every grep
for this family, including
test_no_backend_module_hardcodes_a_gameweek_in_an_odds_path, was globbed to
.py and .js. They all passed, honestly, while the label a reader actually
looks at was wrong. A mechanical check is only as wide as its glob, and the
glob is part of the assertion.

tests/web/test_no_hardcoded_gameweek_in_markup.py now covers the markup.

**Deleted in `91bc231` (2026-08-29).** Zero callers, confirmed by grep across `frontend/`, `backend/` and `tests/` before removal. The surviving comment above `fixtureFor` records what was removed and why, worded so it does not read as the function returning. **One correction to this issue: it was not the last known instance.** Two more turned up this week, and both were live rather than dead: - `FX_START = 1` in the fixtures grid — a module-level literal moved only by the pager, so the grid opened on GW1-6 for the rest of the season unless the user paged past it by hand (`e433040`). - **Nine `GW1` literals in `index.html`** — three panel headings on Matches, two on Fixtures, a clean-sheet hint, an accuracy kicker, and two paragraphs. The tab printed "Match predictions · GW1" above gameweek 3's fixtures, reported by the user with a screenshot (`281c7a9`). The second is the one worth carrying forward: every previous fix and every grep for this family, including `test_no_backend_module_hardcodes_a_gameweek_in_an_odds_path`, was globbed to `.py` and `.js`. They all passed, honestly, while the label a reader actually looks at was wrong. **A mechanical check is only as wide as its glob, and the glob is part of the assertion.** `tests/web/test_no_hardcoded_gameweek_in_markup.py` now covers the markup.
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
solvreven/FPL#15
No description provided.