Skip to content

Commit

Permalink
Merge pull request #61 from Syriiin/fix/outdated-membership-scores
Browse files Browse the repository at this point in the history
Fix update_membership() keeping outdated scores
  • Loading branch information
Syriiin authored Jun 2, 2024
2 parents 3bce099 + 55e133d commit 5916bed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions leaderboards/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ def get_performance_total(score: Score, score_set: ScoreSet):
unique_fields=["membership_id", "score_id"],
)

outdated_membershipscores = MembershipScore.objects.filter(
membership=membership
).exclude(score_id__in=[score.id for score in scores])
outdated_membershipscores.delete()

membership.score_count = len(membership_scores)

membership.pp = calculate_pp_total(
Expand Down

0 comments on commit 5916bed

Please sign in to comment.