Gamification 0.9.94 / Rewards
Streaks and leaderboards
Track timezone-aware consistency and fast materialized rankings.
Pro streaks qualify a member once per daily, weekly, or monthly period in an explicit IANA timezone, with optional missed-period tolerance. Immutable qualification rows coexist with a compact current/longest projection.
Leaderboards materialize exact scores for balances, earned points, streaks, achievements, or quest completions. Visibility may be public, members-only, or administrator-only, and members can opt out. Rebuilds use source records and locks so live writes do not race a repair.
Streak and leaderboard list rows open versioned editors. Every revision requires a change note, rejects stale edit screens, and archives the replaced definition. Pause and save a published streak before changing its event, recipient, calendar frequency, timezone, or missed-period allowance; once qualification history exists, those fields are permanently locked. Presentation and status remain editable, while new semantics belong in a new streak. Leaderboard metric, source, period, and timezone changes are safe because scores are materialized projections: saving the new version rebuilds them atomically from authoritative source records and schedules a bounded repair if the immediate rebuild cannot finish.
Host integrations consume the read-only cointacted_gamification_project_leaderboards() projection instead of reading tables or mirroring balances. The projection includes published, viewer-visible definitions and their already-materialized rows, preserves exact decimal strings and tie ranks, and can be bounded by board identifiers and row count. A host adapter may attach its own member profiles and presentation metadata, but Cointacted remains the score authority.
