Don't show following years' books in a year's goal

This commit is contained in:
Mouse Reeve 2021-05-10 14:38:57 -07:00
parent 08346b7f87
commit e34ae18e98

View file

@ -372,7 +372,10 @@ class AnnualGoal(BookWyrmModel):
def books(self): def books(self):
"""the books you've read this year""" """the books you've read this year"""
return ( 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") .order_by("-finish_date")
.all() .all()
) )
@ -396,7 +399,8 @@ class AnnualGoal(BookWyrmModel):
def book_count(self): def book_count(self):
"""how many books you've read this year""" """how many books you've read this year"""
return self.user.readthrough_set.filter( 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() ).count()