Skip to main content
Petanque Life

Player Statistics

F10.01 15 features Shipped

At a glance

Player Statistics turns every recorded match into a personal performance record, covering wins and losses, formats, playing positions, partners, head-to-head records, and dual ranking trajectories. Numbers refresh continuously through pre-computed rollups and a live-delta layer, so a player's public profile and private dashboard always reflect the most recent mène, whether the match was casual or officially counted.

How it works

Each finalized match emits a normalized event into the analytics pipeline, where a worker fans it out into per-player AnalyticsRollup documents bucketed by day, week, and month. The upserts are idempotent and keyed on player_id + bucket + dimension, so re-running a closure (for example after a result correction) deterministically rewrites the same row instead of double-counting. Hourly cron jobs roll up the current day, a daily_close job seals yesterday at midnight tenant-time, and a monthly_close job locks the prior month for trend charts.

For today's bucket a thin in-memory live-delta layer adds events that arrived since the last hourly tick, so the public profile and the player's own dashboard always look up-to-date without waiting for the next cron tick. Match statistics (F10.01.01) and win rate by format (F10.01.02) are read straight from these rollups; performance by competition level (F10.01.03), season-by-season comparison (F10.01.05), and casual vs official breakdown (F10.01.14) just slice the same rollups by an extra dimension. Head-to-head records (F10.01.04) and partnership statistics (F10.01.15) are stored in pair-keyed rollups (player_id, opponent_id) and (player_id, partner_id) so the comparison view can be answered by a single indexed read.

Position effectiveness (F10.01.06) reads per-position rollups (pointeur/tireur/milieu) populated from the position field on each lineup. ELO and Federation Points history charts (F10.01.11, F10.01.12) and the dual ranking comparison (F10.01.13) are rendered from append-only rating snapshots, with the dual chart aligning two series on the same time axis. Career statistics, milestones, and best results (F10.01.07, F10.01.08) come from a separate aggregate that watches for thresholds (100 wins, first podium, longest streak).

Activity metrics (F10.01.09) and the public player stats page (F10.01.10) are gated by privacy settings, so a player can publish, restrict to federation, or hide their profile entirely.

Key capabilities

  • Day/week/month AnalyticsRollup with idempotent upsert for safe replays
  • Live-delta on top of hourly rollup so today's stats stay current
  • Per-position pointeur/tireur/milieu effectiveness breakdown
  • Head-to-head and partnership win-rate aggregates per opponent and per partner
  • ELO + Federation Points dual trajectory chart on the same time axis
  • Casual vs official game separation so private play doesn't pollute ranked stats
  • Public player stats page with privacy gating per profile

In practice

Léa finishes a regional triplettes final on Sunday afternoon. The umpire submits the result, the analytics worker writes a rollup row for Léa's day-bucket, and her in-memory live-delta picks it up within seconds. She opens her profile on the way home: her win rate by format ticks up, her head-to-head versus this weekend's opponent now reads 3-2, and her ELO history chart shows a fresh upward step next to her Federation Points line.

She taps the partnership tab and sees that her win rate with Camille has just crossed 70%, which earns a milestone badge. The public stats page, which her club president has bookmarked, shows the exact same numbers because both views read the same rollup.

Features in this subsystem

15
ID Status Features
F10.01.01 Shipped Match statistics (wins, losses, draws, points for/against) ✅ PL-F1001a
F10.01.02 Shipped Win rate by format (singles, doubles, triples) ✅ PL-F1001a
F10.01.03 Shipped Performance by competition level ✅ PL-F1001a
F10.01.04 Shipped Head-to-head records ✅ PL-F1001a
F10.01.05 Shipped Season-by-season comparison ✅ PL-F1001a
F10.01.06 Shipped Playing position effectiveness (pointer, shooter, middle) ✅ PL-F1001b
F10.01.07 Shipped Career statistics and milestones ✅ PL-F1001b
F10.01.08 Shipped Best results and achievements ✅ PL-F1001b
F10.01.09 Shipped Activity metrics (competitions entered, matches played) ✅ PL-F1001b
F10.01.10 Shipped Public player stats page ✅ PL-F1001b
F10.01.11 Shipped ELO rating history chart (progression over time) ✅ PL-F1001c
F10.01.12 Shipped Federation Points history chart ✅ PL-F1001c
F10.01.13 Shipped Dual ranking comparison (ELO vs Federation Points trajectory) ✅ PL-F1001c
F10.01.14 Shipped Casual vs official game breakdown ✅ PL-F1001c
F10.01.15 Shipped Partnership statistics (win rate with different partners) ✅ PL-F1001c