Skip to content

Commit 8665fea

Browse files
committed
Apply copilot code review suggestions
1 parent 3597d4d commit 8665fea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ureport/stats/migrations/0033_backfill_poll_stats_counters_dedupes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@ def backfill_poll_stats_counters(apps, schema_editor): # pragma: no cover
7777
poll_stats_counters_ids_count = len(poll_stats_counters_ids)
7878

7979
for batch in chunk_list(poll_stats_counters_ids, 1000):
80-
PollStatsCounter.objects.filter(pk__in=list(batch)).delete()
80+
batch_ids = list(batch)
81+
PollStatsCounter.objects.filter(pk__in=batch_ids).delete()
8182

8283
poll_engagement_daily_count_ids = PollEngagementDailyCount.objects.filter(flow_result_id__in=flow_result_ids)
8384
poll_engagement_daily_count_ids = list(poll_engagement_daily_count_ids.values_list("pk", flat=True))
8485

8586
poll_engagement_daily_count_ids_count = len(poll_engagement_daily_count_ids)
8687

8788
for batch in chunk_list(poll_engagement_daily_count_ids, 1000):
88-
PollEngagementDailyCount.objects.filter(pk__in=list(batch)).delete()
89+
batch_ids = list(batch)
90+
PollEngagementDailyCount.objects.filter(pk__in=batch_ids).delete()
8991
print(
9092
"Backfill for the first time, Deleted %d PollStatsCounter and %d PollEngagementDailyCount entries"
9193
% (poll_stats_counters_ids_count, poll_engagement_daily_count_ids_count)

0 commit comments

Comments
 (0)