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
- Entity changes (
src/matches/entities/match-prediction.entity.ts):
derived/denormalized column for now — set it from the predicted
- Migration:
<timestamp>-AddScorelineAndPointsToMatchPrediction.ts —
- Indexer —
extractEventData() 'PredictionSubmitted' case: add
- 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
Background
`src/matches/entities/match-prediction.entity.
Goal
Store the predicted scoreline, compute
points_earnedper prediction usingthe 1/3/4-point rules (multiplied by
points_multiplier), and keepis_correctas a derived "result was correct" flag for backwardscompatibility with existing consumers (
getUserScore,ParticipantWithStats).Tasks
src/matches/entities/match-prediction.entity.ts):derived/denormalized column for now — set it from the predicted
<timestamp>-AddScorelineAndPointsToMatchPrediction.ts—extractEventData()'PredictionSubmitted'case: addhandlePredictionSubmitted():predicted_home_score/predicted_away_scorefrom the eventpredicted_outcomefrom the scoreline:predicted_outcomeAcceptance Criteria
match_predictionstable haspredicted_home_score,calculatePredictionPointsreturns4for an exact-score correcthandleMatchResultSubmitted()grades all predictions for a match andGET /creator-events/:id/score/:addressincludestotalPointsand