Skip to content

Commit

Permalink
Merge pull request #319 from peppy/pp-back-to-model
Browse files Browse the repository at this point in the history
Ensure pp is saved back to model when calculated
  • Loading branch information
smoogipoo authored Jan 23, 2025
2 parents ce1032b + 817cfb2 commit b47e5eb
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,24 @@ public async Task<bool> ProcessScoreAsync(SoloScore score, MySqlConnection conne

if (score.is_legacy_score && write_legacy_score_pp)
{
score.pp = performanceAttributes.Total;

var helper = LegacyDatabaseHelper.GetRulesetSpecifics(score.ruleset_id);
await connection.ExecuteAsync($"UPDATE scores SET pp = @Pp WHERE id = @ScoreId; UPDATE {helper.HighScoreTable} SET pp = @Pp WHERE score_id = @LegacyScoreId", new
{
ScoreId = score.id,
LegacyScoreId = score.legacy_score_id,
Pp = performanceAttributes.Total,
Pp = score.pp
}, transaction: transaction);
}
else
{
score.pp = performanceAttributes.Total;

await connection.ExecuteAsync("UPDATE scores SET pp = @Pp WHERE id = @ScoreId", new
{
ScoreId = score.id,
Pp = performanceAttributes.Total
Pp = score.pp,
}, transaction: transaction);
}

Expand Down

0 comments on commit b47e5eb

Please sign in to comment.