SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit feeb646d authored by George Katsikas's avatar George Katsikas :goat:
Browse files

warn of unvetted objects in earlier editorial page

parent 3660b182
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,11 @@ __license__ = "AGPL v3" ...@@ -5,8 +5,11 @@ __license__ = "AGPL v3"
import datetime import datetime
from django.db import models from django.db import models
from django.db.models import Q
from django.utils import timezone from django.utils import timezone
from comments.models import Comment
from .. import constants from .. import constants
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
...@@ -397,6 +400,26 @@ class SubmissionQuerySet(models.QuerySet): ...@@ -397,6 +400,26 @@ class SubmissionQuerySet(models.QuerySet):
.exclude(has_qualification=True, has_readiness=True, has_clearance=True) .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): class SubmissionEventQuerySet(models.QuerySet):
def for_edadmin(self): def for_edadmin(self):
......
...@@ -373,7 +373,15 @@ container border border-warning border-3 ...@@ -373,7 +373,15 @@ container border border-warning border-3
</ul> </ul>
</li> </li>
{% else %} {% 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 %} {% endif %}
{% endwith %} {% endwith %}
...@@ -388,7 +396,15 @@ container border border-warning border-3 ...@@ -388,7 +396,15 @@ container border border-warning border-3
</ul> </ul>
</li> </li>
{% else %} {% 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 %} {% endif %}
{% endwith %} {% endwith %}
{% if submission.eic_recommendation_required %} {% if submission.eic_recommendation_required %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment