Skip to content

Commit

Permalink
Fix country filter
Browse files Browse the repository at this point in the history
  • Loading branch information
booxter committed Nov 21, 2024
1 parent 510c08e commit 83ebe5f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/letsrolld/webapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,20 @@ def _execute_section_plan(db, config, seen_films):
# TODO: support multiple genres filter
query = query.join(models.Film.genres).filter(models.Genre.name == config.genre)
if config.exclude_genres:
query = query.join(models.Film.genres).filter(
~models.Genre.name.in_(config.exclude_genres)
query = query.filter(
~models.Film.genres.any(models.Genre.name.in_(config.exclude_genres))
)

if config.country:
# TODO: support multiple countries filter
query = query.join(models.Film.countries).filter(
models.Country.name == config.country
)
if config.exclude_countries:
query = query.join(models.Film.genres).filter(
~models.Genre.name.in_(config.exclude_countries)
query = query.filter(
~models.Film.countries.any(
models.Country.name.in_(config.exclude_countries)
)
)

if config.min_year:
Expand Down

0 comments on commit 83ebe5f

Please sign in to comment.