]> git.parisson.com Git - teleforma.git/commitdiff
add command to extract users having uploaded same script filename
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 26 Jan 2026 21:12:53 +0000 (22:12 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 26 Jan 2026 21:12:53 +0000 (22:12 +0100)
(HOTFIX)

teleforma/management/commands/teleforma-get-same-scripts.py [new file with mode: 0644]

diff --git a/teleforma/management/commands/teleforma-get-same-scripts.py b/teleforma/management/commands/teleforma-get-same-scripts.py
new file mode 100644 (file)
index 0000000..21d479c
--- /dev/null
@@ -0,0 +1,20 @@
+from django.core.management.base import BaseCommand
+from teleforma.exam.models import Script
+from teleforma.models import Period
+from datetime import datetime, timedelta
+
+
+class Command(BaseCommand):
+    help = "Get all users having uploaded the same script filename"
+
+    def handle(self, *args, **options):
+        name = args[0]
+        period = Period.objects.get(name=name)
+        users = []
+        scripts = []
+        for script in Script.objects.filter(period=period):
+            ss = Script.objects.filter(file=script.file)
+            for s in ss:
+                scripts.append(s)
+                users.append(s.author)
+        print(users)