From e34ae18e98ce3aea26b0e3c9a3ffd05d72a7dec6 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 10 May 2021 14:38:57 -0700 Subject: [PATCH] Don't show following years' books in a year's goal --- bookwyrm/models/user.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 7c943bec..5f0e64e3 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -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()