Real-Time Conflict-Free Scoring on League Night
On league night, two team captains often score the same match simultaneously on separate mobile devices. Here is how LeagueMaster delivers instant updates while preventing data corruption.
The Dual-Entry Paradigm
Section titled “The Dual-Entry Paradigm”Unlike recreational apps where a single scorekeeper controls the sheet, competitive pool requires mutual verification:
- Both Home and Away scorekeepers track the current rack independently.
- If both devices submit matching rack scores (e.g., Player A pockets the 8-ball in inning 3), the rack transitions to Verified.
- If an input discrepancy occurs (e.g. one captain records 3 innings while the other records 4), the specific field is marked in amber.
Firestore Optimistic Concurrency & Transactions
Section titled “Firestore Optimistic Concurrency & Transactions”To guarantee atomic updates across concurrent mobile devices:
- Every
TeamMatchModelcontains an integerversionfield. - When submitting the final approved score sheet,
ScheduleRepository.saveTeamMatchWithConflictResolution()runs within a Firestore transaction. - If another device modified the score sheet concurrently, the transaction aborts cleanly, fetches the latest delta, and prompts the user to resolve the difference before overwriting.
