From 2831a35cce46f4a01f660f53d9fa1d972b92ae64 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Mon, 30 Sep 2024 16:45:16 +0200
Subject: [PATCH] collect anonymous info for appraisals / offers

fixes #338
---
 .../submissions/managers/qualification.py     | 16 ++++++-------
 .../templates/submissions/offers.html         | 23 +++++++++++++++++++
 2 files changed, 31 insertions(+), 8 deletions(-)
 create mode 100644 scipost_django/submissions/templates/submissions/offers.html

diff --git a/scipost_django/submissions/managers/qualification.py b/scipost_django/submissions/managers/qualification.py
index ccd9faa26..84163dfce 100644
--- a/scipost_django/submissions/managers/qualification.py
+++ b/scipost_django/submissions/managers/qualification.py
@@ -11,18 +11,18 @@ class QualificationQuerySet(models.QuerySet):
         Filter for Fellows which are at least marginally qualified.
         """
         return self.filter(
-            status__in=[
-                self.model.STATUS_EXPERT,
-                self.model.STATUS_VERY_KNOWLEDGEABLE,
-                self.model.STATUS_KNOWLEDGEABLE,
-                self.model.STATUS_MARGINALLY_QUALIFIED,
+            expertise_level__in=[
+                self.model.EXPERT,
+                self.model.VERY_KNOWLEDGEABLE,
+                self.model.KNOWLEDGEABLE,
+                self.model.MARGINALLY_QUALIFIED,
             ]
         )
 
     def not_qualified(self):
         return self.filter(
-            status__in=[
-                self.model.STATUS_NOT_REALLY_QUALIFIED,
-                self.model.STATUS_NOT_AT_ALL_QUALIFIED,
+            expertise_level__in=[
+                self.model.NOT_REALLY_QUALIFIED,
+                self.model.NOT_AT_ALL_QUALIFIED,
             ]
         )
diff --git a/scipost_django/submissions/templates/submissions/offers.html b/scipost_django/submissions/templates/submissions/offers.html
new file mode 100644
index 000000000..914ac4114
--- /dev/null
+++ b/scipost_django/submissions/templates/submissions/offers.html
@@ -0,0 +1,23 @@
+
+
+<ul>
+  <li>
+    Your submission has examined by {{ submission.qualification_set.all|length }} fellow{{ submission.qualification_set.all|pluralize }}, of which {{ submission.qualification_set.all|length }} are sufficiently qualified on the subject matter to take charge.
+  </li>
+</ul>
+
+
+
+{% regroup offers|dictsort:"offered_on" by condition_details as offers_by_type %}
+
+<ul>
+
+  {% for offers in offers_by_type %}
+    {% with offer=offers.list.0 %}
+      <li>
+        {{ offers.list|length }} offers for {{ offer.condition }}, accept first {{ offer.id }}
+      </li>
+    {% endwith %}
+  {% endfor %}
+
+</ul>
-- 
GitLab