Skip to content

Commit

Permalink
Uses gameStart to organize games for historical predictions (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasdotcom authored Jun 21, 2024
1 parent e57fb6b commit 975cea7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pages/[league]/[user]/predictions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const get_predictions = async (
opponent.fullName as away_team_name,
historicalClubs.teamScore AS home_score,
historicalClubs.opponentScore AS away_score,
0 as gameStart,
historicalClubs.gameStart as gameStart,
0 as gameEnd,
historicalPredictions.home AS home_prediction,
historicalPredictions.away AS away_prediction
Expand Down
3 changes: 3 additions & 0 deletions scripts/upgradeDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ export default async function main(oldVersion: string): Promise<string> {
await connection.query(
"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",
);
await connection.query(
"UPDATE historicalClubs SET gameStart=rowid WHERE gameStart IS NULL",
);
// Due to an error in how the points were calculated for predictions a recalculation is needed (Copied from calcPoints.ts)
await Promise.all(
(
Expand Down

0 comments on commit 975cea7

Please sign in to comment.