Skip to content

Commit

Permalink
Ensure empty updates don't cause full db recalc
Browse files Browse the repository at this point in the history
Tricky one!
  • Loading branch information
Syriiin committed Jun 8, 2024
1 parent cb7d31e commit ef40a6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion profiles/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ def update_performance_calculations(
unique_fields=["beatmap_id", "mods", "calculator_engine"],
)
# TODO: remove when bulk_create(update_conflicts) returns pks in django 5.0
unique_beatmap_query = Q()
unique_beatmap_query = Q(
pk__in=[] # ensures no-op if somehow there are no unique beatmaps
)
for beatmap_id, mods in unique_beatmaps:
unique_beatmap_query |= Q(beatmap_id=beatmap_id, mods=mods)
difficulty_calculations = DifficultyCalculation.objects.filter(
Expand Down

0 comments on commit ef40a6c

Please sign in to comment.