Skip to content

[Backend] — Scoreline predictions & points-based grading (1 / 3 / 4 points) #955

@Olowodarey

Description

@Olowodarey

Background

`src/matches/entities/match-prediction.entity.

Goal

Store the predicted scoreline, compute points_earned per prediction using
the 1/3/4-point rules (multiplied by points_multiplier), and keep
is_correct as a derived "result was correct" flag for backwards
compatibility with existing consumers (getUserScore, ParticipantWithStats).

Tasks

  1. Entity changes (src/matches/entities/match-prediction.entity.ts):
    derived/denormalized column for now — set it from the predicted
  2. Migration: <timestamp>-AddScorelineAndPointsToMatchPrediction.ts
  3. Indexer — extractEventData() 'PredictionSubmitted' case: add
  4. Indexer — handlePredictionSubmitted():
    • persist predicted_home_score / predicted_away_score from the event
    • derive predicted_outcome from the scoreline:
    • replace the current strict validation against a predicted_outcome

Acceptance Criteria

  • match_predictions table has predicted_home_score,
  • calculatePredictionPoints returns 4 for an exact-score correct
  • handleMatchResultSubmitted() grades all predictions for a match and
  • GET /creator-events/:id/score/:address includes totalPoints and

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions