Skip to content

Commit 975cea7

Browse files
authored
Uses gameStart to organize games for historical predictions (#765)
1 parent e57fb6b commit 975cea7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pages/[league]/[user]/predictions/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export const get_predictions = async (
192192
opponent.fullName as away_team_name,
193193
historicalClubs.teamScore AS home_score,
194194
historicalClubs.opponentScore AS away_score,
195-
0 as gameStart,
195+
historicalClubs.gameStart as gameStart,
196196
0 as gameEnd,
197197
historicalPredictions.home AS home_prediction,
198198
historicalPredictions.away AS away_prediction

scripts/upgradeDB.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,9 @@ export default async function main(oldVersion: string): Promise<string> {
669669
await connection.query(
670670
"UPDATE historicalClubs as hc1 SET gameStart=(SELECT gameStart FROM historicalClubs as hc2 WHERE hc2.club=hc1.opponent AND hc1.league=hc2.league AND hc1.time=hc2.time) WHERE home=0",
671671
);
672+
await connection.query(
673+
"UPDATE historicalClubs SET gameStart=rowid WHERE gameStart IS NULL",
674+
);
672675
// Due to an error in how the points were calculated for predictions a recalculation is needed (Copied from calcPoints.ts)
673676
await Promise.all(
674677
(

0 commit comments

Comments
 (0)