Skip to content

Commit

Permalink
fix: query param order
Browse files Browse the repository at this point in the history
  • Loading branch information
invaderb committed Jun 19, 2024
1 parent 6e4939b commit e316907
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/models/ratings/ratings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ export class RatingService {
// Update players loop
this.logger.debug('Updating players');
for (let i = 0; i < playersArray.length; i++) {
playersArray[i].fatiguerating = this.adjustedRating(
playersArray[i],
Date.now(),
PARTICIPATION_CUTOFF,
RATING_RETENTION,
MAX_DROP,
PARTICIPATION_LIMIT,
);
if (playersArray[i].changed) {
await updatePlayer(
playersArray[i].rating,
Expand All @@ -322,13 +330,13 @@ export class RatingService {
playersArray[i].maxrating,
playersArray[i].ratingage,
JSON.stringify(playersArray[i].fatigue),
this.adjustedRating(playersArray[i], Date.now(), PARTICIPATION_CUTOFF, RATING_RETENTION, MAX_DROP, PARTICIPATION_LIMIT),
playersArray[i].id,
playersArray[i].fatiguerating,
);
} else {
// always update a players fatiguerating even if they haven't changed
const updateFatigueRatingQuery = `UPDATE players SET fatiguerating=? where id=?;`;
await playerRunner.manager.query(updateFatigueRatingQuery, [this.adjustedRating(playersArray[i], Date.now(), PARTICIPATION_CUTOFF, RATING_RETENTION, MAX_DROP, PARTICIPATION_LIMIT), playersArray[i].id]);
await playerRunner.manager.query(updateFatigueRatingQuery, [playersArray[i].fatiguerating, playersArray[i].id]);
}
}
await playerRunner.commitTransaction();
Expand Down

0 comments on commit e316907

Please sign in to comment.