Skip to content

Fix fantasy football scoring for knockout/playoff stage in JS scraper app

Session from merchantscroll-traces on Hugging Face by vedalken · MIT · condensed by Coders Talk

1msession
1interventions
GOAL

Investigate whether the fantacalcio site's API marks playoff/knockout games, then adjust how those matches count toward the total score (Punteggio) according to the tournament regolamento.

  1. Prompt · +0
    From the calendar API, can you identify if a game is from the playoff? The website shows 'playoff maschile' text.
  2. Agent did · +0m
    Investigated scrape.js, compute-scores.js and live API groups/fixtures endpoints; found groups have a `kind` field (girone/playoffs/bracket) that identifies playoff and knockout stages.
  3. Prompt · +0m
    Exclude knockout stage points from the fantasy total (Punteggio) but keep them visible on the frontend, per the regolamento PDF.
  4. Agent did · +0m
    Read the regolamento PDF and found it conflicted with the request; asked clarifying questions about rule 7 (playoffs) and the -2 malus before changing scoring.
  5. Agent did · +0m
    Implemented exclusion of knockout/play-in points from Punteggio across compute-scores.js, build-classifica.js, squad-sheet.js, updated tests and Readme, ran full test suite successfully.
  6. Intervention · +0m
    Developer said the agent was wrong: rule 7 actually says the playoff DOES count for the score, only the malus should not apply for skipping the play-in specifically.
    Why: I misread which rule applied — the playoff points needed to count, just without penalizing people who skipped the optional play-in round.
  7. Agent did · +0m
    Reverted the exclusion: playoffs and knockouts now count toward Punteggio again, with malus only starting at the ottavi (bracket) stage, not for skipping the play-in. Updated tests and docs, ran full suite.
  8. Prompt · +0m
    Push this updated version.
  9. Agent did · +0m
    Committed changes, rebased onto origin/main to pick up auto-update commits, and pushed to main.
  10. Fail · +1m
    Developer reported a player still showing -2 points after the fix; live data hadn't been recomputed with the new rule, so stale malus values were still on the site.
  11. Outcome · +1m
    Rebuilt scores with npm run build, confirmed -2 malus removed (player's total corrected from padding to 14 from 3 matches), committed and pushed as 7ba0945 to main; site expected to update in 2-5 minutes.
VERDICT

Next time I'd paste the exact regolamento rule text into the first prompt instead of describing it from memory, since the agent's first read of rule 7 was wrong and I had to correct it after it built and tested the opposite behavior. The correction that actually mattered was pointing out that playoffs DO count but skipping the optional play-in shouldn't trigger the malus — that's what got the logic right. It also missed that changing the scoring rule doesn't retroactively fix already-computed live data, so I had to ask again to force a rebuild before the site reflected it.

I tried this · 0

Discussion · 0

How Builds work