Skip to content

feat: Cloud Function to aggregate matchLog into playerProfile #21

Description

@ibloud

Summary

Build a post-game aggregator that reads completed matchLogs and updates playerProfiles/{playerToken} (Phase 1 key), with did support for Phase 2 migration.

Implementation

  • Trigger on match completion (or scheduled processor of completed logs).
  • Compute and persist:
    • matchesPlayed, wins, losses, winRate
    • acpl
    • veilRate, opponentVeilRate
    • sacrificeRate
    • comebackWins
    • inversionClause totals (total, blind, seal)
  • Upsert playerProfiles with createdAt/updatedAt.
  • Keep researchConsent default false.

Acceptance Criteria

  • Profile doc updates correctly after a completed match.
  • Metrics are deterministic from the same matchLogs.
  • Re-processing is idempotent (no double-counting).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    player-profileplayerProfiles schema/persistencestat-capturemove log + aggregation work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions