SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit c0fef025 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Cache `thread_sequence_order`

parent 021d3703
No related branches found
No related tags found
No related merge requests found
...@@ -349,7 +349,7 @@ class Submission(models.Model): ...@@ -349,7 +349,7 @@ class Submission(models.Model):
return Submission.objects.public().filter(thread_hash=self.thread_hash).order_by( return Submission.objects.public().filter(thread_hash=self.thread_hash).order_by(
'-submission_date', '-preprint') '-submission_date', '-preprint')
@property @cached_property
def thread_sequence_order(self): def thread_sequence_order(self):
"""Return the ordering of this Submission within its thread.""" """Return the ordering of this Submission within its thread."""
return self.thread.filter(submission_date__lt=self.submission_date).count() + 1 return self.thread.filter(submission_date__lt=self.submission_date).count() + 1
......
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