diff --git a/scipost_django/submissions/managers/decision.py b/scipost_django/submissions/managers/decision.py index 361cbb0a54522101751147c17e2a1bee415a7974..771e7aad55fdd2dc57c6989116d28c76627a5e2f 100644 --- a/scipost_django/submissions/managers/decision.py +++ b/scipost_django/submissions/managers/decision.py @@ -6,5 +6,11 @@ from django.db import models class EditorialDecisionQuerySet(models.QuerySet): + def deprecated(self): + return self.filter(status=self.model.DEPRECATED) + + def nondeprecated(self): + return self.exclude(status=self.model.DEPRECATED) + def latest_version(self): return self.order_by("-version").first() diff --git a/scipost_django/submissions/models/submission.py b/scipost_django/submissions/models/submission.py index 4b3eb645bdfc792279a346d6ac43dc4f13af227d..131f0c9be671762b08eb64aebf810dc71760d37b 100644 --- a/scipost_django/submissions/models/submission.py +++ b/scipost_django/submissions/models/submission.py @@ -522,8 +522,8 @@ class Submission(models.Model): @property def editorial_decision(self): """Returns the latest EditorialDecision (if it exists).""" - if self.editorialdecision_set.exists(): - return self.editorialdecision_set.latest_version() + if self.editorialdecision_set.nondeprecated().exists(): + return self.editorialdecision_set.nondeprecated().latest_version() return None diff --git a/scipost_django/submissions/templates/submissions/_recommendation_fellow_content.html b/scipost_django/submissions/templates/submissions/_recommendation_fellow_content.html index 1eba6ff519ce6729bcf08a03c113ba624e19b994..93644df3966571719d50f97f4281948a2c1ff292 100644 --- a/scipost_django/submissions/templates/submissions/_recommendation_fellow_content.html +++ b/scipost_django/submissions/templates/submissions/_recommendation_fellow_content.html @@ -132,6 +132,16 @@ {% else %} <a class="btn btn-primary" href="{% url 'submissions:editorial_decision_detail' recommendation.submission.preprint.identifier_w_vn_nr %}" role="button">View the editorial decision <small>(status: {{ recommendation.submission.editorial_decision.get_status_display }})</small></a> {% endif %} + {% if recommendation.submission.editorialdecision_set.deprecated %} + <p> + Deprecated decisions: + <ul> + {% for decision in recommendation.submission.editorialdecision_set.deprecated %} + <li>{{ decision }}</li> + {% endfor %} + </ul> + </p> + {% endif %} </li> <li class="list-item my-2"> <a class="btn btn-warning" href="{% url 'submissions:restart_refereeing' recommendation.submission.preprint.identifier_w_vn_nr %}" role="button">Restart the latest refereeing round (leads to confirmation page)</a> diff --git a/scipost_django/submissions/templates/submissions/_submission_editorial_information.html b/scipost_django/submissions/templates/submissions/_submission_editorial_information.html index a45fd1384304406a347f888877bdc3b5e93b7929..16067e77ca11535eac9b917d072d7f2f26661182 100644 --- a/scipost_django/submissions/templates/submissions/_submission_editorial_information.html +++ b/scipost_django/submissions/templates/submissions/_submission_editorial_information.html @@ -39,6 +39,13 @@ For Journal {{ submission.editorial_decision.for_journal }}: {{ submission.editorial_decision.get_decision_display }} <br> (status: {{ submission.editorial_decision.get_status_display }}) + {% elif submission.editorialdecision_set.deprecated %} + Deprecated decisions: + <ul> + {% for decision in submission.editorialdecision_set.deprecated %} + <li>{{ decision }}</li> + {% endfor %} + </ul> {% else %} <span class="label label-secondary">No Editorial Decision has been taken yet.</span> {% endif %}