Premier League Predictor: FastAPI & PostgreSQL — Chapter 6, Exercise 3 ==================================================== TASK Enter an incorrect result for a real fixture with at least two predictions already recorded, confirm their points_awarded values, then call PATCH again with the corrected result and confirm every prediction's points_awarded actually changed to reflect the correction. SOLUTION Using fixture_id 42 with two predictions already recorded (a user prediction of 2-1, an expert prediction of 1-1): 1. Enter a deliberately wrong first result: PATCH /api/fixtures/42/result {"home_score": 1, "away_score": 1} 2. Call GET /api/fixtures/42/predictions and check points_awarded: - user (2-1): outcome is home_win (2>1); the entered result 1-1 is a draw. Different outcomes, no exact match either → points_awarded = 0. - expert (1-1): exact match against the entered 1-1 result → points_awarded = 40. 3. Now correct the result to the real one: PATCH /api/fixtures/42/result {"home_score": 2, "away_score": 1} 4. Call GET /api/fixtures/42/predictions again and check points_awarded: - user (2-1): now an exact match against the corrected 2-1 result → points_awarded = 40. - expert (1-1): a draw prediction against a corrected home-win result → different outcomes → points_awarded = 0. Both predictions' points_awarded values genuinely flipped — the user went from 0 to 40, the expert went from 40 to 0 — confirming that enter_result really does loop over and recompute every prediction on the fixture from scratch each time it runs, rather than only scoring predictions the first time a result is entered. WHY THIS WORKS AS AN ANSWER ---------------------------- It walks through a real before-and-after sequence with two predictions that swap which one scores well depending on which result is entered (chosen deliberately so the correction produces a visible, verifiable change in both directions), confirming in practice that rescoring on correction works exactly as Chapter 6's own finding-box described.