diff --git a/submissions/constants.py b/submissions/constants.py index 5252e752e27ddad562a456d07f9893ef681cef8f..355621e77004c12a8dab18633e2e5ca5c7da8add 100644 --- a/submissions/constants.py +++ b/submissions/constants.py @@ -58,11 +58,11 @@ SUBMISSION_STATUS_OUT_OF_POOL = SUBMISSION_HTTP404_ON_EDITORIAL_PAGE + [ ] SUBMISSION_EXCLUDE_FROM_REPORTING = SUBMISSION_HTTP404_ON_EDITORIAL_PAGE + [ - STATUS_AWAITING_ED_REC, - STATUS_REVIEW_CLOSED, - STATUS_ACCEPTED, - STATUS_VOTING_IN_PREPARATION, - STATUS_PUT_TO_EC_VOTING, + # STATUS_AWAITING_ED_REC, + # STATUS_REVIEW_CLOSED, + # STATUS_ACCEPTED, + # STATUS_VOTING_IN_PREPARATION, + # STATUS_PUT_TO_EC_VOTING, STATUS_WITHDRAWN, ] @@ -208,6 +208,21 @@ REPORT_STATUSES = ( (STATUS_NOT_ACADEMIC, 'Rejected (not academic in style)') ) +REPORT_NORMAL = 'report_normal' +REPORT_POST_PUBLICATION = 'report_post_pub' +REPORT_TYPES = ( + (REPORT_NORMAL, 'Normal Report'), + (REPORT_POST_PUBLICATION, 'Post-publication Report'), +) + +POST_PUBLICATION_STATUSES = [ + STATUS_AWAITING_ED_REC, + STATUS_REVIEW_CLOSED, + STATUS_ACCEPTED, + STATUS_VOTING_IN_PREPARATION, + STATUS_PUT_TO_EC_VOTING, +] + CYCLE_DEFAULT = 'default' CYCLE_SHORT = 'short' CYCLE_DIRECT_REC = 'direct_rec' diff --git a/submissions/forms.py b/submissions/forms.py index ee1365c2b8033b8aca7292f66a0cee41ed5facb5..2de2fca2daf2ef4208e8565a826d8a3b0f316025 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -9,7 +9,8 @@ from .constants import ASSIGNMENT_BOOL, ASSIGNMENT_REFUSAL_REASONS, STATUS_RESUB REPORT_ACTION_CHOICES, REPORT_REFUSAL_CHOICES, STATUS_REVISION_REQUESTED,\ STATUS_REJECTED, STATUS_REJECTED_VISIBLE, STATUS_RESUBMISSION_INCOMING,\ STATUS_DRAFT, STATUS_UNVETTED, REPORT_ACTION_ACCEPT, REPORT_ACTION_REFUSE,\ - STATUS_VETTED, EXPLICIT_REGEX_MANUSCRIPT_CONSTRAINTS, SUBMISSION_STATUS + STATUS_VETTED, EXPLICIT_REGEX_MANUSCRIPT_CONSTRAINTS, SUBMISSION_STATUS,\ + POST_PUBLICATION_STATUSES, REPORT_POST_PUBLICATION, REPORT_NORMAL from . import exceptions, helpers from .models import Submission, RefereeInvitation, Report, EICRecommendation, EditorialAssignment,\ iThenticateReport @@ -536,6 +537,8 @@ class ReportForm(forms.ModelForm): } }) + self.submission = kwargs.pop('submission') + super(ReportForm, self).__init__(*args, **kwargs) self.fields['strengths'].widget.attrs.update({ 'placeholder': ('Give a point-by-point ' @@ -577,14 +580,19 @@ class ReportForm(forms.ModelForm): if self.fields[field].required: self.fields[field].label += ' *' - def save(self, submission): + if self.submission.status in POST_PUBLICATION_STATUSES: + self.report_type = REPORT_POST_PUBLICATION + else: + self.report_type = REPORT_NORMAL + + def save(self): """ Update meta data if ModelForm is submitted (non-draft). Possibly overwrite the default status if user asks for saving as draft. """ report = super().save(commit=False) - report.submission = submission + report.submission = self.submission report.date_submitted = timezone.now() # Save with right status asked by user @@ -594,15 +602,15 @@ class ReportForm(forms.ModelForm): report.status = STATUS_UNVETTED # Update invitation and report meta data if exist - invitation = submission.referee_invitations.filter(referee=report.author).first() + invitation = self.submission.referee_invitations.filter(referee=report.author).first() if invitation: invitation.fulfilled = True invitation.save() report.invited = True # Check if report author if the report is being flagged on the submission - if submission.referees_flagged: - if report.author.user.last_name in submission.referees_flagged: + if self.submission.referees_flagged: + if report.author.user.last_name in self.submission.referees_flagged: report.flagged = True report.save() return report diff --git a/submissions/migrations/0002_report_report_type.py b/submissions/migrations/0002_report_report_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1a05cc4ad2b1472746e8d41bcf44631141dde4f1 --- /dev/null +++ b/submissions/migrations/0002_report_report_type.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-01-13 10:14 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='report_type', + field=models.CharField(choices=[('report_normal', 'Normal Report'), ('report_post_pub', 'Post-publication Report')], default='report_normal', max_length=16), + ), + ] diff --git a/submissions/models.py b/submissions/models.py index 5a526bf214336075cb7e142fe344827efa6a0f59..682f837dd60520183ac0e6d016efd64fea361808 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -14,7 +14,8 @@ from .constants import ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL,\ RANKING_CHOICES, REPORT_REC, SUBMISSION_STATUS, STATUS_UNASSIGNED,\ REPORT_STATUSES, STATUS_UNVETTED, SUBMISSION_EIC_RECOMMENDATION_REQUIRED,\ SUBMISSION_CYCLES, CYCLE_DEFAULT, CYCLE_SHORT, CYCLE_DIRECT_REC,\ - EVENT_GENERAL, EVENT_TYPES, EVENT_FOR_AUTHOR, EVENT_FOR_EIC + EVENT_GENERAL, EVENT_TYPES, EVENT_FOR_AUTHOR, EVENT_FOR_EIC,\ + REPORT_TYPES, REPORT_NORMAL from .managers import SubmissionQuerySet, EditorialAssignmentQuerySet, EICRecommendationQuerySet,\ ReportQuerySet, SubmissionEventQuerySet, RefereeInvitationQuerySet from .utils import ShortSubmissionCycle, DirectRecommendationSubmissionCycle,\ @@ -386,6 +387,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): to explicitly implement the perticular differences in for example the form used. """ status = models.CharField(max_length=16, choices=REPORT_STATUSES, default=STATUS_UNVETTED) + report_type = models.CharField(max_length=16, choices=REPORT_TYPES, default=REPORT_NORMAL) submission = models.ForeignKey('submissions.Submission', related_name='reports', on_delete=models.CASCADE) report_nr = models.PositiveSmallIntegerField(default=0, diff --git a/submissions/templates/submissions/submit_report.html b/submissions/templates/submissions/submit_report.html index 8a47160f086f19f9f9adcd332406c088af09e974..b7e1b97a5a3c44db682715e6973020feb67d73ee 100644 --- a/submissions/templates/submissions/submit_report.html +++ b/submissions/templates/submissions/submit_report.html @@ -82,6 +82,9 @@ <div class="card card-grey"> <div class="card-body"> <h1>Your {% if form.instance.is_followup_report %}followup {% endif %}report:</h1> + {% if form.report_type == 'report_post_pub' %} + <p class="text-warning">The Editorial Recommendation for this Submission has already been formulated. Therefore, your report will be flagged as <label class="label label-outline-warning">Post-publication Report</label>.</p> + {% endif %} <p>A preview of text areas will appear below as you type (you can use LaTeX \$...\$ for in-text equations or \ [ ... \ ] for on-line equations).</p> <p class="mb-0">Any fields with an asterisk (*) are required.</p> {% if form.instance.is_followup_report %} diff --git a/submissions/views.py b/submissions/views.py index c3d60869ffb5ebbe8484343702f0f9d36839fb62..0ca51573eba2f46c64fe20bc7eb903a8b725437e 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1284,11 +1284,11 @@ def submit_report(request, arxiv_identifier_w_vn_nr): report_in_draft = submission.reports.in_draft().get(author=current_contributor) except Report.DoesNotExist: report_in_draft = Report(author=current_contributor, submission=submission) - form = ReportForm(request.POST or None, instance=report_in_draft) + form = ReportForm(request.POST or None, instance=report_in_draft, submission=submission) # Check if data sent is valid if form.is_valid(): - newreport = form.save(submission) + newreport = form.save() if newreport.status == STATUS_DRAFT: messages.success(request, ('Your Report has been saved. ' 'You may carry on working on it,'