forked from mirrors/bookwyrm
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