diff --git a/site-observable/docs/data/films.sqlite.py b/site-observable/docs/data/films.sqlite.py index 0b747e2..ea4c860 100755 --- a/site-observable/docs/data/films.sqlite.py +++ b/site-observable/docs/data/films.sqlite.py @@ -26,7 +26,38 @@ df = df[df["release_date"] < now] # Remove movies with no known revenue - df = df[df["revenue"] > 0] + # and original_language other than EU languages + df = df[ + (df["revenue"] == 0) + & ( + df["original_language"].isin( + [ + "cs", + "da", + "de", + "en", + "es", + "et", + "fi", + "fr", + "hr", + "hu", + "is", + "it", + "lt", + "lv", + "nl", + "no", + "pl", + "pt", + "ro", + "sl", + "sv", + ], + ) + ) + | (df["revenue"] > 0) + ] # Add a column with the production_year based on the release_date df["production_year"] = df["release_date"].dt.year diff --git a/site-observable/docs/films.md b/site-observable/docs/films.md index 72e67ee..e9aa64b 100644 --- a/site-observable/docs/films.md +++ b/site-observable/docs/films.md @@ -23,8 +23,20 @@ const db = FileAttachment("data/films.sqlite").sqlite(); ```js const results = db.query( - `SELECT *, (SELECT COUNT(*) FROM films) total FROM films WHERE films.title LIKE ? COLLATE NOCASE ORDER BY films.title LIMIT 20`, - [`${query}%`] + ` + SELECT + *, + (SELECT COUNT(*) FROM films) total + FROM + films + WHERE + films.title LIKE ? COLLATE NOCASE + OR films.original_title LIKE ? COLLATE NOCASE + ORDER BY + films.title + LIMIT + 20`, + [`%${query}%`, `%${query}%`] ); ``` diff --git a/site-observable/docs/shows.md b/site-observable/docs/shows.md index 929c626..5f8cb47 100644 --- a/site-observable/docs/shows.md +++ b/site-observable/docs/shows.md @@ -22,8 +22,19 @@ const db = FileAttachment("data/shows.sqlite").sqlite(); ```js const results = db.query( - `SELECT *, (SELECT COUNT(*) FROM shows) total FROM shows WHERE shows.name LIKE ? COLLATE NOCASE ORDER BY shows.name ASC LIMIT 20`, - [`${query}%`] + ` + SELECT + *, + (SELECT COUNT(*) FROM shows) total + FROM + shows + WHERE + shows.name LIKE ? COLLATE NOCASE OR + shows.original_name LIKE ? COLLATE NOCASE + ORDER BY + shows.name ASC + LIMIT 20`, + [`%${query}%`, `%${query}%`] ); ```