diff --git a/submissions/migrations/0085_auto_20200720_0648.py b/submissions/migrations/0085_auto_20200720_0648.py new file mode 100644 index 0000000000000000000000000000000000000000..fd4fedfd1d639865bed4acb5ec247c7c9657ab54 --- /dev/null +++ b/submissions/migrations/0085_auto_20200720_0648.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.11 on 2020-07-20 04:48 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0084_preprintserver'), + ] + + operations = [ + migrations.AlterField( + model_name='submission', + name='submission_date', + field=models.DateTimeField(default=datetime.datetime.now, verbose_name='submission date'), + ), + ] diff --git a/submissions/models/report.py b/submissions/models/report.py index 933736e5663fb697d21833d14f4e4a41472b2ba4..b6ee4635706750f4da0e20bb40cd89681a562cc0 100644 --- a/submissions/models/report.py +++ b/submissions/models/report.py @@ -184,8 +184,8 @@ class Report(SubmissionRelatedObjectMixin, models.Model): field if this information becomes necessary in more general information representation. """ return (self.author.reports.accepted().filter( - submission__preprint__identifier_wo_vn_nr=self.submission.preprint.identifier_wo_vn_nr, - submission__preprint__vn_nr__lt=self.submission.preprint.vn_nr).exists()) + submission__thread_hash=self.submission.thread_hash, + submission__submission_date__lt=self.submission.submission_date).exists()) @property def associated_published_doi(self): @@ -210,7 +210,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): """ try: publication = Publication.objects.get( - accepted_submission__preprint__identifier_wo_vn_nr=self.submission.preprint.identifier_wo_vn_nr) + accepted_submission__thread_hash=self.submission.thread_hash) except Publication.DoesNotExist: return None diff --git a/submissions/models/submission.py b/submissions/models/submission.py index b2f94f9df02ca257383b8665b07cbaafd0c5553d..9686aaddc2a82433c91c841bd11d579914b210c6 100644 --- a/submissions/models/submission.py +++ b/submissions/models/submission.py @@ -123,7 +123,9 @@ class Submission(models.Model): # Metadata metadata = JSONField(default=dict, blank=True, null=True) - submission_date = models.DateField(verbose_name='submission date', default=datetime.date.today) + submission_date = models.DateTimeField( + verbose_name='submission date', + default=datetime.datetime.now) acceptance_date = models.DateField(verbose_name='acceptance date', null=True, blank=True) latest_activity = models.DateTimeField(auto_now=True) update_search_index = models.BooleanField(default=True) @@ -155,7 +157,7 @@ class Submission(models.Model): if self.is_current: header += ' (current version)' else: - header += ' (deprecated version ' + str(self.preprint.vn_nr) + ')' + header += ' (deprecated version ' + str(self.thread_sequence_order) + ')' if hasattr(self, 'publication') and self.publication.is_published: header += ' (published as %s (%s))' % ( self.publication.doi_string, self.publication.publication_date.strftime('%Y')) @@ -320,10 +322,15 @@ class Submission(models.Model): return Submission.objects.public().filter(thread_hash=self.thread_hash).order_by( '-submission_date', '-preprint__vn_nr') + @property + def thread_sequence_order(self): + """Return the ordering of this Submission within its thread.""" + return self.thread.filter(submission_date__lt=self.submission_date).count() + 1 + @cached_property def other_versions(self): """Return other Submissions in the database in this thread.""" - return self.get_other_versions().order_by('-preprint__vn_nr') + return self.get_other_versions().order_by('-submission_date', '-preprint__vn_nr') def get_other_versions(self): """Return queryset of other Submissions with this thread.""" diff --git a/submissions/templates/partials/submissions/pool/submission_info_table.html b/submissions/templates/partials/submissions/pool/submission_info_table.html index 19b6a013a390c428cbb8aa5ae129ae0c27b6f660..0304dabe3eb1f6607463c833f9b28f141868a2fd 100644 --- a/submissions/templates/partials/submissions/pool/submission_info_table.html +++ b/submissions/templates/partials/submissions/pool/submission_info_table.html @@ -1,7 +1,7 @@ <table class="w-100 mb-1"> <tr> <td style="min-width: 40%;">Version</td> - <td>{{ submission.preprint.vn_nr }} ({% if submission.is_current %}current version{% else %}deprecated version {{ submission.preprint.vn_nr }}{% endif %})</td> + <td>{{ submission.thread_sequence_order }} ({% if submission.is_current %}current version{% else %}out of a sequence of {{ submission.thread|length }}{% endif %})</td> </tr> {% if submission.preprint.url %} <tr> diff --git a/submissions/templates/partials/submissions/submission_card_content.html b/submissions/templates/partials/submissions/submission_card_content.html index ff6bd995582c8bcfaa2de6cc83efbc5714f06f16..562ae68d8a1190aa7e46a0b6ce911a3096325aae 100644 --- a/submissions/templates/partials/submissions/submission_card_content.html +++ b/submissions/templates/partials/submissions/submission_card_content.html @@ -2,7 +2,7 @@ {% block card_footer %} <p class="meta"> - Version {{ submission.preprint.vn_nr }} ({% if submission.is_current %}current version{% else %}deprecated version {{ submission.preprint.vn_nr }}{% endif %}) + Version {{ submission.thread_sequence_order }} ({% if submission.is_current %}current version{% else %}out of a sequence of {{ submission.thread|length }}{% endif %}) <br> {% if submission.publication and submission.publication.is_published %} Published as <a href="{{ submission.publication.get_absolute_url }}"> diff --git a/submissions/templates/partials/submissions/submission_version.html b/submissions/templates/partials/submissions/submission_version.html index 83acdc4964b9ec1e98d8814affd5b5d204c7fd14..dec7ad6ba54e289bee0cb155ff90ce7ed4586406 100644 --- a/submissions/templates/partials/submissions/submission_version.html +++ b/submissions/templates/partials/submissions/submission_version.html @@ -1,10 +1,10 @@ <div class="py-1"> - <a href="{{submission.get_absolute_url}}" class="pubtitleli">version {{submission.preprint.vn_nr}}</a> + <a href="{{ submission.get_absolute_url }}" class="pubtitleli">version {{ submission.thread_sequence_order }}</a> <span class="version-suffix"> {% if submission.is_current %} (current version) {% else %} - (deprecated version {{submission.preprint.vn_nr}}) + (out of a sequence of {{ submission.thread|length }}) {% endif %} </span> </div> diff --git a/submissions/templates/submissions/submission_form.html b/submissions/templates/submissions/submission_form.html index 80f7e35942115f7992da5f235c28c8ec6bb7c763..d0f543464e4ac88d67d6527d933b2df7fab84851 100644 --- a/submissions/templates/submissions/submission_form.html +++ b/submissions/templates/submissions/submission_form.html @@ -35,7 +35,7 @@ <div class="row"> <div class="col-12"> <h1 class="highlight">Submit a manuscript to SciPost - {% if form.identifier_w_vn_nr.value %} <span class="my-1 py-0 text-blue">{{form.identifier_w_vn_nr.value}}{% if form.submission_is_resubmission %} <small>(resubmission)</small>{% endif %}</span>{% endif %} + {% if form.identifier_w_vn_nr.value %} <span class="my-1 py-0 text-blue">{{ form.identifier_w_vn_nr.value }}{% if form.submission_is_resubmission %} <small>(resubmission)</small>{% endif %}</span>{% endif %} </h1> </div> diff --git a/submissions/views.py b/submissions/views.py index 10ff77c15a5d3e842c49953b7b9224d3817efa3f..e68796d01d1f848a4f575e8e09d66259cf5ed5d2 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -102,7 +102,7 @@ class SubmissionAutocompleteView(autocomplete.Select2QuerySetView): if item.is_current: end_info = ' (current version)' else: - end_info = ' (deprecated version ' + str(item.preprint.vn_nr) + ')' + end_info = ' (deprecated version ' + str(item.thread_sequence_order) + ')' if hasattr(item, 'publication') and item.publication.is_published: end_info += ' (published as %s (%s))' % ( item.publication.doi_string, item.publication.publication_date.strftime('%Y'))