Allow the GM to record event scores and resulting point changes. As much as possible, the point changes should happen automatically based on the event scores.
This would use the following flow:
Event Scoring Map (already implemented)
When creating/editing an event, the GM will enter a scoring map. This is an array of scores assigned to different finishing positions, with the top scorer listed first.
For score_based_single_round events, each element of the array will correspond to a single team placement. The number of elements need not match the number of teams. If there are more teams than elements, then teams with no elements will receive no points. If there are more elements than teams, then subsequent elements will not be used. Note that some events are "lower scores are better", in which case first place is the one with the lowest event score.
For single_* and double_elimination_tournaments, each element of the array will correspond to a finishing round. The winner will receive the first element, runner-up the second, semifinal losers the third, quarterfinal losers the fourth, and so on.
Event Scoring
During the Event phase, the GM will record event scores.
For score_based_single_round events, there will be a GM tool "Enter Round Scores". This will be a list of teams for the active event, each of which has a number input where the GM can enter that team's score. At the bottom will be a "Submit Event Scores" button that submits those scores to the database (see below) and advance the session to "waiting for next round"
Idea: Have this page preview the positions and/or points-to-be-received based on the current scores.
For tournament events, there will be a GM tool "Enter Tournament Results". This will check the database for an in-progress bracket and either recreate that bracket object or create a new bracket. The GM can then tap on teams to select winners. Once the first winner has been selected, the GM will no longer be able to edit teams. There will be two buttons: Save Progress and Submit Tournament Results. The former will only be active if at least one winner has been selected and will save the bracket state to the database. The latter will only be active if the entire bracket is filled out and will both save the bracket and advance the session to "waiting for next round"
Idea: Store tournament round scores on the database, for analytics purposes
Idea: Only lock teams once their first round has been resolved
Idea: Add a "regenerate bracket" button in case the bracket needs to be redone
TODO: Determine the format for saving an in-progress/finished bracket on the database
Awarding Points
For score_based_single_round events, the submit button will trigger a database function to post the scores to the event_team_round_score table, calculate everybody's positions, use positions to determine everyone's scores, create transactions for those score changes, and advance the round.
For tournaments, the submit button will trigger a database function to save the final bracket, determine the round everyone lost in (for double-elims this is the round where you had your second loss), use those round numbers to determine everyone's scores, create transactions for those score changes, and advance to the next round.
Idea: Have a "points preview" page where the GM can review the proposed score changes and tweak as needed
Idea: Have an "event results" page that shows positions/"losing rounds" and the resulting score changes that everyone can see
Allow the GM to record event scores and resulting point changes. As much as possible, the point changes should happen automatically based on the event scores.
This would use the following flow:
Event Scoring Map (already implemented) When creating/editing an event, the GM will enter a scoring map. This is an array of scores assigned to different finishing positions, with the top scorer listed first.
Event Scoring During the Event phase, the GM will record event scores.
Awarding Points