diff --git a/concordia/models.py b/concordia/models.py index 580d286d1..d953f6ae6 100644 --- a/concordia/models.py +++ b/concordia/models.py @@ -42,22 +42,22 @@ def resource_file_upload_path(instance, filename): class ConcordiaUserManager(BaseUserManager): def review_incidents(self): - user_incident_count = {} + user_incident_count = [] for user in self.get_queryset().filter(is_superuser=False, is_staff=False): incident_count = user.review_incidents() if incident_count > 0: - user_incident_count[user.id] = incident_count + user_incident_count.append((user.id, user.username, incident_count)) return user_incident_count def transcribe_incidents(self): - user_incident_count = {} + user_incident_count = [] for user in self.get_queryset().filter(is_superuser=False, is_staff=False): incident_count = user.transcribe_incidents() if incident_count > 0: - user_incident_count[user.id] = incident_count + user_incident_count.append((user.id, user.username, incident_count)) return user_incident_count diff --git a/concordia/tasks.py b/concordia/tasks.py index 120ad3152..fbd33ab94 100644 --- a/concordia/tasks.py +++ b/concordia/tasks.py @@ -1044,14 +1044,6 @@ def fix_storage_images(campaign_slug=None, asset_start_id=None): logger.debug("%s / %s (%s%%)", count, full_count, str(count / full_count * 100)) -def transcribing_too_quickly(): - return Transcription.objects.transcribing_too_quickly() - - -def reviewing_too_quickly(): - return Transcription.objects.reviewing_too_quickly() - - @celery_app.task(ignore_result=True) def clear_sessions(): # This clears expired Django sessions in the database diff --git a/concordia/tests/test_models.py b/concordia/tests/test_models.py index 8a106095a..ce064c94a 100644 --- a/concordia/tests/test_models.py +++ b/concordia/tests/test_models.py @@ -77,7 +77,14 @@ def test_review_incidents(self): ) users = ConcordiaUser.objects.review_incidents() self.assertEqual(len(users), 1) - self.assertEqual(users[self.transcription1.reviewed_by.id], 1) + self.assertEqual( + users[0], + ( + self.transcription1.reviewed_by.id, + self.transcription1.reviewed_by.username, + 1, + ), + ) create_transcription( asset=self.transcription1.asset, @@ -93,7 +100,14 @@ def test_review_incidents(self): ) users = ConcordiaUser.objects.review_incidents() self.assertEqual(len(users), 1) - self.assertEqual(users[self.transcription1.reviewed_by.id], 2) + self.assertEqual( + users[0], + ( + self.transcription1.reviewed_by.id, + self.transcription1.reviewed_by.username, + 2, + ), + ) def test_transcribe_incidents(self): self.transcription1.submitted = timezone.now() @@ -124,7 +138,10 @@ def test_transcribe_incidents(self): ) users = ConcordiaUser.objects.transcribe_incidents() self.assertEqual(len(users), 1) - self.assertEqual(users[self.transcription1.user.id], 1) + self.assertEqual( + users[0], + (self.transcription1.user.id, self.transcription1.user.username, 1), + ) create_transcription( asset=self.transcription1.asset, @@ -133,7 +150,10 @@ def test_transcribe_incidents(self): ) users = ConcordiaUser.objects.transcribe_incidents() self.assertEqual(len(users), 1) - self.assertEqual(users[self.transcription1.user.id], 2) + self.assertEqual( + users[0], + (self.transcription1.user.id, self.transcription1.user.username, 2), + ) class AssetTestCase(CreateTestUsers, TestCase):