FutsalLeague Manager includes a prediction game — called the porra — that lets registered users call the outcome of any upcoming match before it kicks off. Correct predictions earn a point, and a season leaderboard ranks every participant. The game runs entirely within the platform: there is nothing extra to install or configure, and every match page displays live community sentiment as soon as the first vote is cast.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526/llms.txt
Use this file to discover all available pages before exploring further.
How voting works
Any registered user can cast or change their prediction on a match while it haspendiente status. The three vote options map directly to the possible results.
| Vote value | Meaning |
|---|---|
local | Home team wins |
empate | Draw |
visitante | Away team wins |
match_votes table with a unique constraint on (match_id, user_id), so submitting a new vote simply replaces the previous one. There is no separate “update vote” endpoint — the same POST /matches/:id/vote call handles both first-time votes and changes.
Voting rules
- Votes are only accepted while the match
statusispendiente. Attempting to vote on anen_cursoorfinalizadomatch returns400 Bad Request. - Both teams must be fully assigned to the match. If either
home_team_idoraway_team_idisnull(placeholder teams used in knockout draws), the server rejects the vote with a400 Bad Requestand an explanatory message. - A user can change their prediction any number of times before the match starts.
- Votes from anonymous (unauthenticated) users are not accepted. A valid JWT is required.
Casting a vote
Point system
Points are awarded automatically inside the match finalization transaction. No separate job or cron is needed.- When
PUT /matches/:id/finishis called, the server determines the actual result:local,visitante, orempate. - All
match_votesrows for the match wherevoteequals the actual result havepoints_awardedset to1. - For each user who predicted correctly, the
user_pointstable is upserted — adding 1 point to their running total for the season (ON CONFLICT DO UPDATE SET points = points + 1).
Points are per-season. A user’s total resets when a new active season begins.
Voting stats on every match
Voting stats are included in every match list and match detail response, regardless of the match’s status. This means the UI always has the data it needs without an extra request.userVote field so the UI can highlight the active choice.
Leaderboard
The prediction leaderboard is available to all visitors — no login required.points descending, with ties broken alphabetically by username.
Personal prediction history
Logged-in users can review their own voting record for the season.real_result: "pendiente" and points_awarded: null. Points are applied retroactively once the match is finalized.