diff --git a/scipost_django/submissions/managers/submission.py b/scipost_django/submissions/managers/submission.py index 5c26f03fe12533b908baa5e80256c67e9d5a2d88..89733fb80dbcfef73adc51d5c579d32f1c3b209b 100644 --- a/scipost_django/submissions/managers/submission.py +++ b/scipost_django/submissions/managers/submission.py @@ -5,8 +5,11 @@ __license__ = "AGPL v3" import datetime from django.db import models +from django.db.models import Q from django.utils import timezone +from comments.models import Comment + from .. import constants from typing import TYPE_CHECKING @@ -397,6 +400,26 @@ class SubmissionQuerySet(models.QuerySet): .exclude(has_qualification=True, has_readiness=True, has_clearance=True) ) + def comments_set_complete(self): + """Return Comments on Submissions, Reports and other Comments.""" + qs = Comment.objects.filter( + Q(submissions__in=self) + | Q(reports__submission__in=self) + | Q(comments__reports__submission__in=self) + | Q(comments__submissions__in=self) + ) + # Add recursive comments: + for c in qs: + if c.nested_comments: + qs = qs | c.all_nested_comments().all() + return qs.distinct() + + def reports(self): + """Return all Reports for Submissions.""" + from submissions.models import Report + + return Report.objects.filter(submission__in=self) + class SubmissionEventQuerySet(models.QuerySet): def for_edadmin(self): diff --git a/scipost_django/submissions/templates/submissions/pool/editorial_page.html b/scipost_django/submissions/templates/submissions/pool/editorial_page.html index 9840c7fc27d8f7842cadb3e1404f062bcce148e9..d8ac0f299fd6d41c63dc1436f7cbb97d81ce21f7 100644 --- a/scipost_django/submissions/templates/submissions/pool/editorial_page.html +++ b/scipost_django/submissions/templates/submissions/pool/editorial_page.html @@ -373,7 +373,15 @@ container border border-warning border-3 </ul> </li> {% else %} - <li>All Reports have been vetted.</li> + {% with submission.other_versions.reports.awaiting_vetting as other_reports %} + <li>All Reports on this version have been vetted. + {% if other_reports %} + <span class="text-warning ms-1">{% include "bi/exclamation-triangle-fill.html" %}</span> + There {{ other_reports|pluralize:"is,are" }} still {{ other_reports.count }} + Report{{ other_reports|pluralize }} awaiting vetting on other versions. + {% endif %} + </li> + {% endwith %} {% endif %} {% endwith %} @@ -388,7 +396,15 @@ container border border-warning border-3 </ul> </li> {% else %} - <li>All Comments have been vetted.</li> + {% with submission.other_versions.comments_set_complete.awaiting_vetting as other_comments %} + <li>All Comments on this version have been vetted. + {% if other_comments %} + <span class="text-warning ms-1">{% include "bi/exclamation-triangle-fill.html" %}</span> + There {{ other_comments|pluralize:"is,are" }} still {{ other_comments.count }} + Comment{{ other_comments|pluralize }} awaiting vetting on other versions. + {% endif %} + </li> + {% endwith %} {% endif %} {% endwith %} {% if submission.eic_recommendation_required %}