SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit c5e88b93 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Update Report to accept blank fields (2)

parent 29e5b68b
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-07-21 08:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submissions', '0048_auto_20170721_0936'),
]
operations = [
migrations.AlterField(
model_name='report',
name='formatting',
field=models.SmallIntegerField(blank=True, choices=[(6, 'perfect'), (5, 'excellent'), (4, 'good'), (3, 'reasonable'), (2, 'acceptable'), (1, 'below threshold'), (0, 'mediocre')], null=True, verbose_name='Quality of paper formatting'),
),
migrations.AlterField(
model_name='report',
name='grammar',
field=models.SmallIntegerField(blank=True, choices=[(6, 'perfect'), (5, 'excellent'), (4, 'good'), (3, 'reasonable'), (2, 'acceptable'), (1, 'below threshold'), (0, 'mediocre')], null=True, verbose_name='Quality of English grammar'),
),
migrations.AlterField(
model_name='report',
name='qualification',
field=models.PositiveSmallIntegerField(choices=[(4, 'expert in this subject'), (3, 'very knowledgeable in this subject'), (2, 'knowledgeable in this subject'), (1, 'generally qualified'), (0, 'not qualified')], verbose_name='Qualification to referee this: I am'),
),
migrations.AlterField(
model_name='report',
name='remarks_for_editors',
field=models.TextField(blank=True, verbose_name='optional remarks for the Editors only'),
),
]
...@@ -4,6 +4,7 @@ from django.utils import timezone ...@@ -4,6 +4,7 @@ from django.utils import timezone
from django.db import models from django.db import models
from django.contrib.postgres.fields import JSONField from django.contrib.postgres.fields import JSONField
from django.urls import reverse from django.urls import reverse
from django.utils.functional import cached_property
from .constants import ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL,\ from .constants import ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL,\
SUBMISSION_TYPE, ED_COMM_CHOICES, REFEREE_QUALIFICATION, QUALITY_SPEC,\ SUBMISSION_TYPE, ED_COMM_CHOICES, REFEREE_QUALIFICATION, QUALITY_SPEC,\
...@@ -261,7 +262,7 @@ class Report(models.Model): ...@@ -261,7 +262,7 @@ class Report(models.Model):
author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE) author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE)
qualification = models.PositiveSmallIntegerField( qualification = models.PositiveSmallIntegerField(
choices=REFEREE_QUALIFICATION, choices=REFEREE_QUALIFICATION,
verbose_name="Qualification to referee this: I am ") verbose_name="Qualification to referee this: I am")
# Text-based reporting # Text-based reporting
strengths = models.TextField(blank=True) strengths = models.TextField(blank=True)
...@@ -270,32 +271,52 @@ class Report(models.Model): ...@@ -270,32 +271,52 @@ class Report(models.Model):
requested_changes = models.TextField(verbose_name="requested changes", blank=True) requested_changes = models.TextField(verbose_name="requested changes", blank=True)
# Qualities: # Qualities:
validity = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101) validity = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101,
significance = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101) null=True, blank=True)
originality = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101) significance = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101,
clarity = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101) null=True, blank=True)
formatting = models.SmallIntegerField(choices=QUALITY_SPEC, originality = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101,
null=True, blank=True)
clarity = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101,
null=True, blank=True)
formatting = models.SmallIntegerField(choices=QUALITY_SPEC, null=True, blank=True,
verbose_name="Quality of paper formatting") verbose_name="Quality of paper formatting")
grammar = models.SmallIntegerField(choices=QUALITY_SPEC, grammar = models.SmallIntegerField(choices=QUALITY_SPEC, null=True, blank=True,
verbose_name="Quality of English grammar") verbose_name="Quality of English grammar")
recommendation = models.SmallIntegerField(choices=REPORT_REC) recommendation = models.SmallIntegerField(choices=REPORT_REC)
remarks_for_editors = models.TextField(default='', blank=True, remarks_for_editors = models.TextField(blank=True,
verbose_name='optional remarks for the Editors only') verbose_name='optional remarks for the Editors only')
anonymous = models.BooleanField(default=True, verbose_name='Publish anonymously') anonymous = models.BooleanField(default=True, verbose_name='Publish anonymously')
# 'validity',
# 'significance',
# 'originality',
# 'clarity',
# 'formatting',
# 'grammar',
objects = ReportManager() objects = ReportManager()
def __str__(self): def __str__(self):
return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' + return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' +
self.submission.title[:50] + ' by ' + self.submission.author_list[:50]) self.submission.title[:50] + ' by ' + self.submission.author_list[:50])
def is_followup_report(self, kip=None): @cached_property
def is_followup_report(self):
""" """
Check if current Report is a `FollowupReport`. A Report is a `FollowupReport` if the Check if current Report is a `FollowupReport`. A Report is a `FollowupReport` if the
author of the report already has a vetted report in the series of the specific Submission. author of the report already has a vetted report in the series of the specific Submission.
""" """
return self.author.report_set.accepted().filter(submission=self.submission).exists() return (self.author.report_set.accepted()
.filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr)
.exists())
def latest_report_from_series(self):
"""
Get latest Report from the same author for the Submission series.
"""
return (self.author.report_set.accepted()
.filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr)
.order_by('submission__arxiv_identifier_wo_vn_nr').last())
########################## ##########################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment