fix: update query in readme

refactor: only show movies with at least one title in upcoming movies
main
daniel-michel 2024-01-08 14:57:03 +01:00
parent 0ea9aef7be
commit f698ebcfbe
3 changed files with 13 additions and 7 deletions

View File

@ -27,7 +27,8 @@ SELECT
WHERE {
?movie wdt:P31 wd:Q11424; # Q11424 is the item for "film"
wdt:P577 ?releaseDate. # P577 is the "publication date" property
FILTER (xsd:date(?releaseDate) >= xsd:date("$date"^^xsd:dateTime))
?movie p:P577/psv:P577 [wikibase:timePrecision ?precision].
FILTER (xsd:date(?releaseDate) >= xsd:date("$date"^^xsd:dateTime) && ?precision >= 10)
}
GROUP BY ?movie
ORDER BY ?minReleaseDate

View File

@ -50,16 +50,21 @@ class HomePage extends StatelessWidget {
Scaffold(
body: MovieManagerList(
manager,
// Only show movies that have a release date with at least month precision
// Only show movies that are bookmarked or have a release date with at least month precision and at least one title
filter: (movie) =>
movie.releaseDate.precision >= DatePrecision.month,
movie.bookmarked ||
(movie.releaseDate.precision >= DatePrecision.month &&
(movie.titles?.length ?? 0) >= 1),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.refresh),
onPressed: () => manager.loadUpcomingMovies(),
),
),
MovieManagerList(manager, filter: (movie) => movie.bookmarked)
MovieManagerList(
manager,
filter: (movie) => movie.bookmarked,
)
],
),
),

View File

@ -192,9 +192,9 @@ class DateWithPrecisionAndCountry {
return switch (precision) {
DatePrecision.decade =>
"${DateFormat("yyyy").format(date).substring(0, 3)}0s",
DatePrecision.year => date.year.toString(),
DatePrecision.month => DateFormat("MMMM yyyy").format(date),
DatePrecision.day => DateFormat("MMMM d, yyyy").format(date),
DatePrecision.year => DateFormat.y().format(date),
DatePrecision.month => DateFormat.yMMMM().format(date),
DatePrecision.day => DateFormat.yMMMMd().format(date),
DatePrecision.hour => DateFormat("MMMM d, yyyy, HH").format(date),
DatePrecision.minute => DateFormat("MMMM d, yyyy, HH:mm").format(date)
};