fix discarding ratings
We want to limit the number of movies, not ratings. By limiting the number of movie IDs before loading all ratings with those movie IDs we can achieve this.
This commit is contained in:
parent
a6adfefdd8
commit
f602542f43
1 changed files with 1 additions and 1 deletions
|
|
@ -217,6 +217,7 @@ async def find_ratings(
|
||||||
SELECT * FROM newest_movies
|
SELECT * FROM newest_movies
|
||||||
UNION ALL -- using ALL here avoids the reordering of IDs
|
UNION ALL -- using ALL here avoids the reordering of IDs
|
||||||
SELECT * FROM unrated_movies
|
SELECT * FROM unrated_movies
|
||||||
|
LIMIT :limit_rows
|
||||||
)""",
|
)""",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
@ -238,7 +239,6 @@ async def find_ratings(
|
||||||
LEFT JOIN {Rating._table} ON {Rating._table}.movie_id={source_table}.movie_id
|
LEFT JOIN {Rating._table} ON {Rating._table}.movie_id={source_table}.movie_id
|
||||||
-- LEFT JOIN {User._table} ON {User._table}.id={Rating._table}.user_id
|
-- LEFT JOIN {User._table} ON {User._table}.id={Rating._table}.user_id
|
||||||
LEFT JOIN {Movie._table} ON {Movie._table}.id={source_table}.movie_id
|
LEFT JOIN {Movie._table} ON {Movie._table}.id={source_table}.movie_id
|
||||||
LIMIT :limit_rows
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
rows = await shared_connection().fetch_all(bindparams(query, values))
|
rows = await shared_connection().fetch_all(bindparams(query, values))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue