mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-18 22:26:34 +00:00
Merge pull request #1067 from bookwyrm-social/goal-year
Don't show following years' books in a year's goal
This commit is contained in:
commit
5efc7280a1
1 changed files with 6 additions and 2 deletions
|
@ -372,7 +372,10 @@ class AnnualGoal(BookWyrmModel):
|
|||
def books(self):
|
||||
"""the books you've read this year"""
|
||||
return (
|
||||
self.user.readthrough_set.filter(finish_date__year__gte=self.year)
|
||||
self.user.readthrough_set.filter(
|
||||
finish_date__year__gte=self.year,
|
||||
finish_date__year__lt=self.year + 1,
|
||||
)
|
||||
.order_by("-finish_date")
|
||||
.all()
|
||||
)
|
||||
|
@ -396,7 +399,8 @@ class AnnualGoal(BookWyrmModel):
|
|||
def book_count(self):
|
||||
"""how many books you've read this year"""
|
||||
return self.user.readthrough_set.filter(
|
||||
finish_date__year__gte=self.year
|
||||
finish_date__year__gte=self.year,
|
||||
finish_date__year__lt=self.year + 1,
|
||||
).count()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue