Premier League Predictor: FastAPI & PostgreSQL — Chapter 4, Exercise 3 ==================================================== TASK Build the full click-to-pair page yourself against a real season and gameweek, enter all 10 fixtures for a gameweek, and then write one sentence explaining what happens when you try to click an 11th team pairing that reuses an already-fixtured team. SOLUTION Steps to complete this exercise: 1. Make sure a Season with exactly 20 SeasonTeam rows exists (built in Chapter 3), and create a Gameweek for it via POST /api/seasons/{season_id}/gameweeks. 2. Save fixtures.html and fixtures.js from this chapter into the static/ folder from Chapter 1, updating the hardcoded seasonId and gameweekId constants at the top of fixtures.js to match the real season and gameweek just created. 3. Start the app (uvicorn main:app --reload) and open http://localhost:8000/fixtures.html. 4. Click through all 20 team buttons in pairs — 10 fixtures total — confirming after each Add Fixture click that both teams' own buttons become disabled (grayed out) and the Home/Away slots reset for the next pair. 5. Once all 20 teams have been used, every team button on the page should be disabled — there's nothing left to click, since the gameweek already has its full 10 fixtures. To actually observe the exercise's own real question, reload the page first (clearing usedTeamIds back to empty) so every button re-enables, then try clicking two teams that were already used in an earlier fixture and click Add Fixture. One-sentence answer for the write-up: clicking Add Fixture with an already-used team sends the request to the server as normal, but create_fixture's own database-backed check rejects it with a 409 and the message "One of these teams is already fixtured this gameweek," which the page displays via alert() — no duplicate fixture gets created, confirming the client-side button graying is just a convenience and the server's own check is what actually enforces the rule. WHY THIS WORKS AS AN ANSWER ---------------------------- It walks through the real setup and full 10-fixture entry process step by step, then deliberately reproduces the "stale page" scenario from Exercise 2 by reloading before attempting the duplicate, and closes with a one-sentence answer that correctly names the real 409 response and message rather than a vague "it doesn't work."