From c135d0a4ec45c6888db2b85747f4e75a107d9495 Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Tue, 2 Apr 2024 12:22:57 +0200 Subject: [PATCH] add short form display of EICRecommendations fixes #91 --- scipost_django/submissions/constants.py | 13 +++++++++++++ scipost_django/submissions/models/recommendation.py | 9 +++++++++ .../pool/_hx_submission_details_contents.html | 4 ++-- .../pool/_submission_details_summary_contents.html | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/scipost_django/submissions/constants.py b/scipost_django/submissions/constants.py index d6d8f9014..ea7f895fa 100644 --- a/scipost_django/submissions/constants.py +++ b/scipost_django/submissions/constants.py @@ -140,6 +140,12 @@ EIC_REC_CHOICES = ( (EIC_REC_MAJOR_REVISION, "Ask for major revision"), (EIC_REC_REJECT, "Reject"), ) +EIC_REC_CHOICES_SHORT = ( + (EIC_REC_PUBLISH, "Publish"), + (EIC_REC_MINOR_REVISION, "Minor revision"), + (EIC_REC_MAJOR_REVISION, "Major revision"), + (EIC_REC_REJECT, "Reject"), +) # Alternative recommendations @@ -185,6 +191,13 @@ EIC_REC_STATUSES = ( (DECISION_FIXED, "Editorial Recommendation fixed"), (DEPRECATED, "Editorial Recommendation deprecated"), ) +EIC_REC_STATUSES_SHORT = ( + (VOTING_IN_PREP, "In preparation"), + (PUT_TO_VOTING, "In voting"), + (VOTE_COMPLETED, "Voting completed"), + (DECISION_FIXED, "Rec. fixed"), + (DEPRECATED, "Rec. deprecated"), +) # Editorial decision diff --git a/scipost_django/submissions/models/recommendation.py b/scipost_django/submissions/models/recommendation.py index 62a6a9d4d..e3bec94a0 100644 --- a/scipost_django/submissions/models/recommendation.py +++ b/scipost_django/submissions/models/recommendation.py @@ -9,9 +9,11 @@ from django.utils import timezone from ..behaviors import SubmissionRelatedObjectMixin from ..constants import ( EIC_REC_CHOICES, + EIC_REC_CHOICES_SHORT, EIC_REC_STATUSES, DECISION_FIXED, DEPRECATED, + EIC_REC_STATUSES_SHORT, VOTING_IN_PREP, PUT_TO_VOTING, ALT_REC_CHOICES, @@ -151,6 +153,13 @@ class EICRecommendation(SubmissionRelatedObjectMixin, models.Model): self.get_status_display(), ) + def get_full_status_short_display(self): + """Return `recommendation` and `status` field display in short form.""" + eicrec_short = dict(EIC_REC_CHOICES_SHORT).get(self.recommendation) + journal_name = self.for_journal.name_abbrev or "" + status_short = dict(EIC_REC_STATUSES_SHORT).get(self.status) + return f"{eicrec_short} - {journal_name} ({status_short})" + class AlternativeRecommendation(models.Model): """Alternative recommendation from voting Fellow who disagrees with EICRec.""" diff --git a/scipost_django/submissions/templates/submissions/pool/_hx_submission_details_contents.html b/scipost_django/submissions/templates/submissions/pool/_hx_submission_details_contents.html index 9557faa02..171184ea1 100644 --- a/scipost_django/submissions/templates/submissions/pool/_hx_submission_details_contents.html +++ b/scipost_django/submissions/templates/submissions/pool/_hx_submission_details_contents.html @@ -154,7 +154,7 @@ <ul class="ps-3"> {% for rec in submission.eicrecommendations.all %} <li> - <a href="{% url 'submissions:eic_recommendation_detail' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">{{ rec.get_full_status_display }}</a> + <a href="{% url 'submissions:eic_recommendation_detail' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">{{ rec.get_full_status_short_display }}</a> {% if is_ed_admin %} {% if rec.voting_in_preparation %} <a class="btn btn-sm btn-primary ms-4 px-1 py-0" role="button" href="{% url 'submissions:prepare_for_voting' rec_id=rec.id %}">Prepare for voting</a> @@ -185,7 +185,7 @@ <ul class="ps-3"> {% for rec in submission.eicrecommendations.all %} <li> - {{ rec.get_full_status_display }}  + {{ rec.get_full_status_short_display }}  {% if rec.undergoing_voting %} {% if rec|user_can_vote:request.user %} <a href="{% url 'submissions:vote_on_rec' rec_id=rec.id %}"> diff --git a/scipost_django/submissions/templates/submissions/pool/_submission_details_summary_contents.html b/scipost_django/submissions/templates/submissions/pool/_submission_details_summary_contents.html index 709054d29..2e6020bb0 100644 --- a/scipost_django/submissions/templates/submissions/pool/_submission_details_summary_contents.html +++ b/scipost_django/submissions/templates/submissions/pool/_submission_details_summary_contents.html @@ -53,7 +53,7 @@ <br> <small class="text-muted">EIC Recommendation & Status</small> <br> - {{ recommendation.get_full_status_display }} + {{ recommendation.get_full_status_short_display }} <br> <small class="text-muted">{{ recommendation.eligible_to_vote.count }} voting: {{ recommendation.voted_for.count }} agreed, {{ recommendation.voted_against.count }} disagreed, {{ recommendation.voted_abstain.count }} abstained</small> {% endif %} -- GitLab