Skip to content

Commit

Permalink
Add comment about removing order by
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincarrogan committed Dec 11, 2024
1 parent ee8712a commit b6103d9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def update_licencedecision_denial_reasons(apps, schema_editor):
.only("denial_reasons__id", "case__licence_decisions__id")
.exclude(denial_reasons__id__isnull=True) # This removes refusals without any criteria
.values_list("denial_reasons__id", "case__licence_decisions__id")
.order_by() # We need to remove the order_by to make sure the distinct works
# The AdviceManager orders by `created_at` and this affects the distinct
# so we remove the ordering completely to ensure the distinct workds as
# expected
.order_by()
.distinct()
)

Expand Down

0 comments on commit b6103d9

Please sign in to comment.