diff --git a/scipost/templatetags/scipost_extras.py b/scipost/templatetags/scipost_extras.py index 25c81e2b02c48f6bed015b8762147284b36d828e..a378cf31277cdda85e8874504559044eeb7d42a1 100644 --- a/scipost/templatetags/scipost_extras.py +++ b/scipost/templatetags/scipost_extras.py @@ -12,7 +12,9 @@ register = template.Library() @register.filter(name='sort_by') def sort_by(queryset, order): - return queryset.order_by(order) + if queryset: + return queryset.order_by(order) + return None @register.filter(name='duration') diff --git a/submissions/templates/submissions/admin/editorial_admin.html b/submissions/templates/submissions/admin/editorial_admin.html index f4daca1875640058f3f10369785d8e4747bdc7ab..9aad2991fad76eab8ada8e6828a53830b0c0a0f5 100644 --- a/submissions/templates/submissions/admin/editorial_admin.html +++ b/submissions/templates/submissions/admin/editorial_admin.html @@ -1,5 +1,7 @@ {% extends 'scipost/_personal_page_base.html' %} +{% load scipost_extras %} + {% block pagetitle %}: Editorial Administration{% endblock pagetitle %} {% block breadcrumb_items %} @@ -20,6 +22,32 @@ <a href="{% url 'submissions:pool' %}">Go to the pool</a> </p> + {% if recommendations_to_prepare_for_voting %} + <h3>Recommendations to prepare for voting <i class="fa fa-exclamation-circle text-warning"></i></h3> + <ul> + {% for recommendation in recommendations_to_prepare_for_voting %} + <li>On Editorial Recommendation: {{ recommendation }}<br> + <a href="{% url 'submissions:prepare_for_voting' rec_id=recommendation.id %}">Prepare for voting</a> + </li> + {% endfor %} + </ul> + {% endif %} + + {% if recommendations_undergoing_voting %} + <h3>Recommendations undergoing voting <i class="fa fa-exclamation-circle text-warning"></i></h3> + <ul> + {% for recommendation in recommendations_undergoing_voting %} + <li>On Editorial Recommendation: {{ recommendation }}<br> + <a href="{% url 'submissions:admin_recommendation' recommendation.submission.arxiv_identifier_w_vn_nr %}">See Editorial Recommendation</a> + </li> + {% endfor %} + </ul> + {% endif %} + + {% if recommendations_to_prepare_for_voting or recommendations_undergoing_voting %} + <hr> + {% endif %} + <h3>Submissions currently in pre-screening</h3> <ul class="list-unstyled"> {% for sub in submission_list.prescreening %} diff --git a/submissions/templates/submissions/admin/recommendation.html b/submissions/templates/submissions/admin/recommendation.html new file mode 100644 index 0000000000000000000000000000000000000000..fb6bb8b0e3c792abe425d611cd1b7c8ccd7e7629 --- /dev/null +++ b/submissions/templates/submissions/admin/recommendation.html @@ -0,0 +1,84 @@ +{% extends 'submissions/pool/base.html' %} + +{% load bootstrap %} +{% load scipost_extras %} + +{% block breadcrumb_items %} + <a href="{% url 'submissions:admin' %}" class="breadcrumb-item">Editorial Administration</a> + <span class="breadcrumb-item">Editorial Recommendation</span> +{% endblock %} + +{% block pagetitle %}: Editorial Recommendation{% endblock pagetitle %} + +{% block content %} + <h1 class="highlight">Editorial Recommendation</h1> + + <div class="card card-outline-secondary"> + {% include 'submissions/_submission_card_fellow_content_sparse.html' with submission=object.submission %} + </div> + + <div class="card card-outline-secondary"> + {% include 'submissions/_recommendation_fellow_content.html' with recommendation=object %} + <div class="card-body"> + {% if object.remarks.exists %} + <h3 class="card-title">Remarks by Fellows:</h3> + <ul> + {% for remark in object.remarks.all|sort_by:'date' %} + {% include 'partials/submissions/remark_as_li.html' with remark=remark %} + {% endfor %} + </ul> + {% endif %} + + <h3 class="card-title">Fellows eligible to vote:</h3> + <ul> + <li> + {% for eligible in object.eligible_to_vote.all|sort_by:'user__last_name' %} + {{ eligible.user.last_name }}, + {% endfor %} + </li> + </ul> + + <h3 class="card-title">Voting results up to now:</h3> + <ul> + <li> + Agreed: ({{ object.voted_for.all.count }}) + {% for agreed in object.voted_for.all|sort_by:'user__last_name' %} + {{ agreed.user.last_name }}, + {% endfor %} + </li> + <li> + Disagreed: ({{ rec.voted_against.all.count }}) + {% for disagreed in rec.voted_against.all|sort_by:'user__last_name' %} + {{ disagreed.user.last_name }}, + {% endfor %} + </li> + <li> + Abstained: ({{ object.voted_abstain.all.count }}) + {% for abstained in object.voted_abstain.all|sort_by:'user__last_name' %} + {{ abstained.user.last_name }}, + {% endfor %} + </li> + </ul> + + {% if object.remarks.exists %} + <h3 class="card-title">Remarks:</h3> + <ul> + {% for rem in object.remarks.all %} + <li>{{ rem }}</li> + {% empty %} + <li><em>No remarks</em></li> + {% endfor %} + </ul> + {% endif %} + </div> + <div class="card-footer"> + <h3 class="card-title">Administrative actions on recommendations undergoing voting:</h3> + <ul> + <li>To send an email reminder to each Fellow with at least one voting duty: <a href="{% url 'submissions:remind_Fellows_to_vote' %}">click here</a></li> + <li>To fix the College decision and follow the Editorial Recommendation as is: <a href="{% url 'submissions:fix_College_decision' rec_id=object.id %}">click here</a></li> + <li>To request a modification of the Recommendation to request for revision: click here</li> + </ul> + </div> + </div> + +{% endblock %} diff --git a/submissions/templates/submissions/pool/recommendation.html b/submissions/templates/submissions/pool/recommendation.html index fd05c4be4d6a89ee92cb2b9a2e1ecd8e0de4a0cf..d2c050bbb0c1b3090e5f8c6d83a35bb2c81c6b24 100644 --- a/submissions/templates/submissions/pool/recommendation.html +++ b/submissions/templates/submissions/pool/recommendation.html @@ -12,9 +12,7 @@ {% block content %} <h1>Editorial Recommendation to vote on</h1> - {# <div class="card card-outline-secondary">#} - {% include 'submissions/_submission_card_fellow_content.html' with submission=recommendation.submission %} - {# </div>#} + {% include 'submissions/_submission_card_fellow_content.html' with submission=recommendation.submission %} {# <div class="card card-outline-secondary">#} {% include 'submissions/_recommendation_fellow_content.html' with recommendation=recommendation %} diff --git a/submissions/urls.py b/submissions/urls.py index 432335b1f3b62669f986e7ccb9c75985c74a1a9f..de96d327d95470e6a4be4217328a80bd4c35006a 100644 --- a/submissions/urls.py +++ b/submissions/urls.py @@ -40,6 +40,8 @@ urlpatterns = [ views.report_pdf_compile, name='report_pdf_compile'), url(r'^admin/reports/(?P<report_id>[0-9]+)/compile$', views.report_pdf_compile, name='report_pdf_compile'), + url(r'^admin/{regex}/recommendation$'.format(regex=SUBMISSIONS_COMPLETE_REGEX), + views.AdminRecommendationView.as_view(), name='admin_recommendation'), url(r'^submit_manuscript$', views.RequestSubmission.as_view(), name='submit_manuscript'), url(r'^submit_manuscript/prefill$', views.prefill_using_arxiv_identifier, diff --git a/submissions/views.py b/submissions/views.py index 47df6ea5571449bcdaf7acd7b8d6a00f01baf434..efc47b44b9ee5e4517db72fc93f8609f44f60bd1 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1521,6 +1521,13 @@ class EditorialSummaryView(SubmissionAdminViewMixin, ListView): except (AssertionError, Submission.DoesNotExist): context['submission'] = None context['latest_events'] = SubmissionEvent.objects.for_eic().last_hours() + + context['recommendations_undergoing_voting'] = ( + EICRecommendation.objects.get_for_user_in_pool(self.request.user) + .filter(submission__status='put_to_EC_voting')) + context['recommendations_to_prepare_for_voting'] = ( + EICRecommendation.objects.get_for_user_in_pool(self.request.user) + .filter(submission__status='voting_in_preparation')) return context @@ -1548,3 +1555,14 @@ class PlagiarismReportPDFView(SubmissionAdminViewMixin, SingleObjectMixin, Redir if not url: raise Http404 return url + + +class AdminRecommendationView(SubmissionAdminViewMixin, DetailView): + permission_required = 'scipost.can_fix_College_decision' + template_name = 'submissions/admin/recommendation.html' + editorial_page = True + + def get_object(self): + """ Get the EICRecommendation as a submission-related instance. """ + submission = super().get_object() + return submission.eicrecommendations.first()