From 1b6c7b82e41475b80b45e47dd1a5a01632286abb Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 7 Feb 2016 09:22:14 +0100
Subject: [PATCH] Change submission model, bug fixes

---
 comments/forms.py                                 |  1 +
 comments/views.py                                 |  2 +-
 .../scipost/vet_registration_requests.html        | 15 ++++-----------
 submissions/models.py                             | 15 ++++++++-------
 4 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/comments/forms.py b/comments/forms.py
index 7b17cd841..98a1ddf85 100644
--- a/comments/forms.py
+++ b/comments/forms.py
@@ -18,6 +18,7 @@ COMMENT_REFUSAL_CHOICES = (
     (-2, 'incorrect'),
     (-3, 'not useful'),
     )
+comment_refusal_dict = dict(COMMENT_REFUSAL_CHOICES)
 
 AUTHOR_REPLY_ACTION_CHOICES = (
 #    (0, 'modify'), 
diff --git a/comments/views.py b/comments/views.py
index 1dd6e5b89..9da2105f8 100644
--- a/comments/views.py
+++ b/comments/views.py
@@ -60,7 +60,7 @@ def vet_submitted_comment_ack(request, comment_id):
                     email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list
                 elif comment.submission is not None:
                     email_text += comment.submission.title + ' by ' + comment.submission.author_list
-                email_text += ', has been rejected for the following reason:' + form.cleaned_data['refusal_reason'] + '.\n\nThank you for your contribution, \nThe SciPost Team.'
+                email_text += ', has been rejected for the following reason:' + comment_refusal_dict[form.cleaned_data['refusal_reason']] + '.\n\nThank you for your contribution, \nThe SciPost Team.'
                 if form.cleaned_data['email_response_field']:
                     email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field']
                 emailmessage = EmailMessage('SciPost Comment rejected', email_text, 'comments@scipost.org', [comment.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org'])
diff --git a/scipost/templates/scipost/vet_registration_requests.html b/scipost/templates/scipost/vet_registration_requests.html
index f9d44dbd4..0e93596b5 100644
--- a/scipost/templates/scipost/vet_registration_requests.html
+++ b/scipost/templates/scipost/vet_registration_requests.html
@@ -58,18 +58,11 @@ $( document ).ready(function() {
   {% for contributor_to_vet in contributors_to_vet %}
   <br>
   <hr>
-  <div class="row">
-    <div class="col-8">
-      <table>
-	<tr><td>Title:</td><td>{{ contributor_to_vet.title }}</td></tr>
-	<tr><td>First name:</td><td>{{ contributor_to_vet.user.first_name }}</td></tr>
-	<tr><td>Last name:</td><td>{{ contributor_to_vet.user.last_name }}</td></tr>
-	<tr><td>email:</td><td>{{ contributor_to_vet.user.email }}</td></tr>
-	<tr><td>user name:</td><td>{{ contributor_to_vet.user.username }}</td></tr>
-	<tr><td>orcid_id:</td><td>{{ contributor_to_vet.orcid_id }}</td></tr>
-      </table>
+  <div class="flex-container">
+    <div class="flex-whitebox">
+      {{ contributor_to_vet.as_table|safe }}
     </div>
-    <div class="col-4">
+    <div class="flex-whitebox">
       <form action="{% url 'scipost:vet_registration_request_ack' contributor_id=contributor_to_vet.id %}" method="post">
 	{% csrf_token %}
 	{{ form.as_p }}
diff --git a/submissions/models.py b/submissions/models.py
index cd5ea8398..fb1ca6746 100644
--- a/submissions/models.py
+++ b/submissions/models.py
@@ -14,12 +14,13 @@ from journals.models import *
 ###############
 
 SUBMISSION_STATUS = (
-    (0, 'unassigned'),
-    (1, 'editor in charge assigned'),
-    (2, 'under review'),
-    (3, 'reviewed, peer checking period'),
-    (4, 'reviewed, peer checked, editorial decision pending'),
-    (5, 'editorial decision'),
+    ('unassigned', 'unassigned'),
+    ('forwarded', 'forwarded to a specialty editor'),
+    ('SEICassigned', 'specialty editor-in-charge assigned'),
+    ('under_review', 'under review'),
+    ('review_completed', 'review period closed, editorial recommendation pending'),
+    ('SEIC_has_recommended', 'specialty editor-in-charge has provided recommendation'),
+    ('decided', 'journal editor-in-chief has fixed decision'),
     )
 submission_status_dict = dict(SUBMISSION_STATUS)
 
@@ -31,7 +32,7 @@ class Submission(models.Model):
     discipline = models.CharField(max_length=20, choices=SCIPOST_DISCIPLINES, default='physics')
     domain = models.CharField(max_length=3, choices=SCIPOST_JOURNALS_DOMAINS)
     specialization = models.CharField(max_length=1, choices=SCIPOST_JOURNALS_SPECIALIZATIONS)
-    status = models.SmallIntegerField(choices=SUBMISSION_STATUS) # set by Editors
+    status = models.CharField(max_length=30, choices=SUBMISSION_STATUS) # set by Editors
     open_for_reporting = models.BooleanField(default=True)
     open_for_commenting = models.BooleanField(default=True)
     title = models.CharField(max_length=300)
-- 
GitLab