Skip to content

Commit

Permalink
Initialize before_date inside method
Browse files Browse the repository at this point in the history
- Seems the issue was due to the fact that the before date was initialized in the method's definition and would be cached. After a day of running, the API would only return the bookmarks before the day it was initialized.
  • Loading branch information
tfnribeiro committed Sep 9, 2024
1 parent f81a9c5 commit 73d1a7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zeeguu/core/model/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def set_learned_language(

if session:
session.add(language)


def set_learned_language_level(
self, language_code: str, cefr_level: str, session=None
Expand Down Expand Up @@ -397,11 +396,13 @@ def all_reading_sessions(
def all_bookmarks(
self,
after_date=datetime.datetime(1970, 1, 1),
before_date=datetime.date.today() + datetime.timedelta(days=1),
before_date=None,
language_id=None,
):
from zeeguu.core.model import Bookmark, UserWord

if before_date is None:
before_date = datetime.date.today() + datetime.timedelta(days=1)
query = zeeguu.core.model.db.session.query(Bookmark)

query = query.join(UserWord, Bookmark.origin_id == UserWord.id)
Expand Down

0 comments on commit 73d1a7f

Please sign in to comment.