From 1faadc1515e8bd9d8b0b4614442a908ec3a99eae Mon Sep 17 00:00:00 2001
From: rasarkar <105652044+rasarkar@users.noreply.github.com>
Date: Tue, 24 Sep 2024 14:53:04 -0400
Subject: [PATCH] CONCD-955 Add new column with total lifetime numbers (#2542)
---
concordia/models.py | 13 +++++++++++--
concordia/templates/emails/unusual_activity.html | 8 ++++++--
concordia/templates/emails/unusual_activity.txt | 4 ++--
concordia/tests/test_models.py | 6 ++++--
4 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/concordia/models.py b/concordia/models.py
index 3821a79d0..537f32e18 100644
--- a/concordia/models.py
+++ b/concordia/models.py
@@ -862,7 +862,9 @@ def review_incidents(self):
user = ConcordiaUser.objects.get(id=user_id)
incident_count = user.review_incidents(recent_accepts, recent_rejects)
if incident_count > 0:
- user_incident_count.append((user.id, user.username, incident_count))
+ user_incident_count.append(
+ (user.id, user.username, incident_count, user.profile.review_count)
+ )
return user_incident_count
@@ -881,7 +883,14 @@ def transcribe_incidents(self):
user = ConcordiaUser.objects.get(id=user_id)
incident_count = user.transcribe_incidents(transcriptions)
if incident_count > 0:
- user_incident_count.append((user.id, user.username, incident_count))
+ user_incident_count.append(
+ (
+ user.id,
+ user.username,
+ incident_count,
+ user.profile.transcribe_count,
+ )
+ )
return user_incident_count
diff --git a/concordia/templates/emails/unusual_activity.html b/concordia/templates/emails/unusual_activity.html
index ac174b59e..c15d2d4ca 100644
--- a/concordia/templates/emails/unusual_activity.html
+++ b/concordia/templates/emails/unusual_activity.html
@@ -10,6 +10,7 @@
{{ title }}
User |
Transc. Incidents |
+ User transcriptions |
{% for row in transcriptions %}
@@ -19,6 +20,7 @@ {{ title }}
{{ row.2 }} |
+ {{ row.3 }} |
{% empty %}
No transcriptions fell within the window. |
@@ -28,8 +30,9 @@ {{ title }}
Incidents of two or more transcriptions reviewed within a single minute:
- User |
- Review Incidents |
+ User |
+ Review Incidents |
+ User reviews |
{% for row in reviews %}
@@ -39,6 +42,7 @@ {{ title }}
{{ row.2 }} |
+ {{ row.3 }} |
{% empty %}
No reviews fell within the window. |
diff --git a/concordia/templates/emails/unusual_activity.txt b/concordia/templates/emails/unusual_activity.txt
index daba6e152..a0d0d6d5d 100644
--- a/concordia/templates/emails/unusual_activity.txt
+++ b/concordia/templates/emails/unusual_activity.txt
@@ -1,13 +1,13 @@
{{ title }}
Incidents of two or more transcriptions submitted within a single minute:
{% for row in transcriptions %}
- * {{ row.1 }} | {{ row.2 }}
+ * {{ row.1 }} | {{ row.2 }} || {{ row.3 }}
{% empty %}
No transcriptions fell within the window.
{% endfor %}
Incidents of two or more transcriptions reviewed within a single minute:
{% for row in reviews %}
- {{ row.1 }} | {{ row.2 }}
+ {{ row.1 }} | {{ row.2 }} | {{ row.3 }}
{% empty %}
No reviews fell within the window.
{% endfor %}
diff --git a/concordia/tests/test_models.py b/concordia/tests/test_models.py
index 6eab495a5..1c2fef276 100644
--- a/concordia/tests/test_models.py
+++ b/concordia/tests/test_models.py
@@ -146,6 +146,7 @@ def test_review_incidents(self):
self.transcription1.reviewed_by.id,
self.transcription1.reviewed_by.username,
1,
+ 2,
),
)
@@ -169,6 +170,7 @@ def test_review_incidents(self):
self.transcription1.reviewed_by.id,
self.transcription1.reviewed_by.username,
2,
+ 2,
),
)
@@ -203,7 +205,7 @@ def test_transcribe_incidents(self):
self.assertEqual(len(users), 1)
self.assertEqual(
users[0],
- (self.transcription1.user.id, self.transcription1.user.username, 1),
+ (self.transcription1.user.id, self.transcription1.user.username, 1, 4),
)
create_transcription(
@@ -215,7 +217,7 @@ def test_transcribe_incidents(self):
self.assertEqual(len(users), 1)
self.assertEqual(
users[0],
- (self.transcription1.user.id, self.transcription1.user.username, 2),
+ (self.transcription1.user.id, self.transcription1.user.username, 2, 5),
)