diff --git a/conflicts/migrations/0007_auto_20180526_1336.py b/conflicts/migrations/0007_auto_20180526_1336.py new file mode 100644 index 0000000000000000000000000000000000000000..960584e358871422c00f8345bb7e2f391e031a8a --- /dev/null +++ b/conflicts/migrations/0007_auto_20180526_1336.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-05-26 11:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('conflicts', '0006_auto_20180526_0923'), + ] + + operations = [ + migrations.AlterField( + model_name='conflictgroup', + name='related_submissions', + field=models.ManyToManyField(blank=True, related_name='conflict_groups', to='submissions.Submission'), + ), + ] diff --git a/submissions/constants.py b/submissions/constants.py index 8483db009905b2fb68f25805af6c08d7d06d2f6f..a77363f82b9be998fe40e82b56f714431e66f99e 100644 --- a/submissions/constants.py +++ b/submissions/constants.py @@ -71,6 +71,18 @@ ASSIGNMENT_REFUSAL_REASONS = ( ('DNP', 'SciPost should not even consider this paper'), ) +STATUS_PREASSIGNED, STATUS_INVITED = 'preassigned', 'invited' +STATUS_DECLINED = 'declined' +STATUS_DEPRECATED, STATUS_COMPLETED = 'deprecated', 'completed' +ASSIGNMENT_STATUSES = ( + (STATUS_PREASSIGNED, 'Pre-assigned'), + (STATUS_INVITED, 'Invited'), + (STATUS_ACCEPTED, 'Accepted'), + (STATUS_DECLINED, 'Declined'), + (STATUS_COMPLETED, 'Completed'), + (STATUS_DEPRECATED, 'Deprecated'), +) + REFEREE_QUALIFICATION = ( (None, '-'), (4, 'expert in this subject'), diff --git a/submissions/migrations/0027_auto_20180526_1336.py b/submissions/migrations/0027_auto_20180526_1336.py new file mode 100644 index 0000000000000000000000000000000000000000..acb95b973d27cb26b2971eca5f88d4c2c7b89734 --- /dev/null +++ b/submissions/migrations/0027_auto_20180526_1336.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-05-26 11:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0026_submission_needs_conflicts_update'), + ] + + operations = [ + migrations.AddField( + model_name='editorialassignment', + name='date_invited', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name='editorialassignment', + name='invitation_order', + field=models.PositiveSmallIntegerField(default=0), + ), + migrations.AddField( + model_name='editorialassignment', + name='status', + field=models.CharField(choices=[('preassigned', 'Pre-assigned'), ('invited', 'Invited'), ('accepted', 'Accepted'), ('declined', 'Declined'), ('completed', 'Completed'), ('deprecated', 'Deprecated')], default='preassigned', max_length=16), + ), + ] diff --git a/submissions/migrations/0028_auto_20180526_1336.py b/submissions/migrations/0028_auto_20180526_1336.py new file mode 100644 index 0000000000000000000000000000000000000000..281b25158cb916784d91d312a4a955f3e56c961d --- /dev/null +++ b/submissions/migrations/0028_auto_20180526_1336.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-05-26 11:36 +from __future__ import unicode_literals + +from django.db import migrations + + +def rename_assignment_statuses(apps, schema_editor): + """Rename EditorialAssignment incoming status.""" + EditorialAssignment = apps.get_model('submissions', 'EditorialAssignment') + + # Update statuses + EditorialAssignment.objects.filter(deprecated=True).update(status='deprecated') + EditorialAssignment.objects.filter(deprecated=False, accepted__isnull=True).update(status='invited') + EditorialAssignment.objects.filter(deprecated=False, accepted=False).update(status='declined') + EditorialAssignment.objects.filter(deprecated=False, accepted=True, completed=False).update(status='accepted') + EditorialAssignment.objects.filter(deprecated=False, accepted=True, completed=True).update(status='completed') + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0027_auto_20180526_1336'), + ] + + operations = [ + migrations.RunPython(rename_assignment_statuses), + ] diff --git a/submissions/models.py b/submissions/models.py index 3eba5ff284f8f927455c096e688e5822dcbff0ee..22a30f4bdf7f2c8448090b20987de3c27ab0e40d 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -15,10 +15,10 @@ from django.utils.functional import cached_property from .behaviors import SubmissionRelatedObjectMixin from .constants import ( - ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL, SUBMISSION_TYPE, + ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL, SUBMISSION_TYPE, STATUS_PREASSIGNED, ED_COMM_CHOICES, REFEREE_QUALIFICATION, QUALITY_SPEC, RANKING_CHOICES, REPORT_REC, SUBMISSION_STATUS, REPORT_STATUSES, STATUS_UNVETTED, STATUS_INCOMING, STATUS_EIC_ASSIGNED, - SUBMISSION_CYCLES, CYCLE_DEFAULT, CYCLE_SHORT, STATUS_RESUBMITTED, DECISION_FIXED, + SUBMISSION_CYCLES, CYCLE_DEFAULT, CYCLE_SHORT, DECISION_FIXED, ASSIGNMENT_STATUSES, CYCLE_DIRECT_REC, EVENT_GENERAL, EVENT_TYPES, EVENT_FOR_AUTHOR, EVENT_FOR_EIC, REPORT_TYPES, REPORT_NORMAL, STATUS_DRAFT, STATUS_VETTED, EIC_REC_STATUSES, VOTING_IN_PREP, STATUS_INCORRECT, STATUS_UNCLEAR, STATUS_NOT_USEFUL, STATUS_NOT_ACADEMIC, DEPRECATED) @@ -370,9 +370,14 @@ class EditorialAssignment(SubmissionRelatedObjectMixin, models.Model): # attribute `deprecated' becomes True if another Fellow becomes Editor-in-charge deprecated = models.BooleanField(default=False) completed = models.BooleanField(default=False) - refusal_reason = models.CharField(max_length=3, choices=ASSIGNMENT_REFUSAL_REASONS, - blank=True, null=True) + status = models.CharField( + max_length=16, choices=ASSIGNMENT_STATUSES, default=STATUS_PREASSIGNED) + refusal_reason = models.CharField( + max_length=3, choices=ASSIGNMENT_REFUSAL_REASONS, blank=True, null=True) + invitation_order = models.PositiveSmallIntegerField(default=0) + date_created = models.DateTimeField(default=timezone.now) + date_invited = models.DateTimeField(blank=True, null=True) date_answered = models.DateTimeField(blank=True, null=True) objects = EditorialAssignmentQuerySet.as_manager()