diff --git a/openlibrary/core/bookshelves.py b/openlibrary/core/bookshelves.py index d0eec5b945f..856d5d96542 100644 --- a/openlibrary/core/bookshelves.py +++ b/openlibrary/core/bookshelves.py @@ -85,7 +85,7 @@ def most_logged_books(cls, shelf_id=None, limit=10, since=False): oldb = db.get_db() where = 'WHERE bookshelf_id' + ('=$shelf_id' if shelf_id else ' IS NOT NULL ') if since: - where += 'AND created >= $since' + where += ' AND created >= $since' query = f'select work_id, count(*) as cnt from bookshelves_books {where}' query += ' group by work_id order by cnt desc limit $limit' logger.info("Query: %s", query)