Skip to content

Commit b66ca62

Browse files
committed
Filter only TigaUser with at least 1 report
1 parent 06a7edf commit b66ca62

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

util_scripts/compute_all_user_scores.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This script fills the newly created point geofield
22
# coding=utf-8
33
import django
4+
from django.db.models import Count
45
import os, sys
56
from tqdm import tqdm
67

@@ -13,6 +14,6 @@
1314
from tigaserver_app.models import TigaUser
1415

1516
if __name__ == "__main__":
16-
qs = TigaUser.objects.all()
17+
qs = TigaUser.objects.annotate(report_count=Count('user_reports')).filter(report_count__gt=0)
1718
for user in tqdm(qs.iterator(), total=qs.count()):
1819
user.update_score(commit=True)

0 commit comments

Comments
 (0)