From ed65bb8127d3a225649a122e5d3b070775c834fe Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sun, 13 Oct 2024 15:10:37 -0700 Subject: [PATCH] chore: filter to query --- config/filters/media.js | 3 +-- src/pages/dynamic/music/artists/artist.html | 4 ++-- src/pages/dynamic/music/concerts.html | 4 ++-- views/media/music/artists.psql | 5 ++--- views/media/music/concerts.psql | 5 +---- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/config/filters/media.js b/config/filters/media.js index 87cc61a5..6ce3c3cf 100644 --- a/config/filters/media.js +++ b/config/filters/media.js @@ -49,6 +49,5 @@ export default { } return `${allButLast} and ${last}` - }, - formatVenue: (venue) => venue.split(',')[0].trim() + } } \ No newline at end of file diff --git a/src/pages/dynamic/music/artists/artist.html b/src/pages/dynamic/music/artists/artist.html index 2c665e8d..3c516cd6 100644 --- a/src/pages/dynamic/music/artists/artist.html +++ b/src/pages/dynamic/music/artists/artist.html @@ -78,9 +78,9 @@ schema: artist {%- capture venue -%} {% if concert.venue_name %} {% if concert.venue_latitude and concert.venue_longitude %} - {{ concert.venue_name | formatVenue }} + {{ concert.venue_name_short }} {% else %} - {{ concert.venue_name | formatVenue }} + {{ concert.venue_name_short }} {% endif %} {% endif %} {%- endcapture -%} diff --git a/src/pages/dynamic/music/concerts.html b/src/pages/dynamic/music/concerts.html index 4f419af3..6d3bfb4c 100644 --- a/src/pages/dynamic/music/concerts.html +++ b/src/pages/dynamic/music/concerts.html @@ -24,9 +24,9 @@ permalink: "/music/concerts/{% if pagination.pageNumber > 0 %}{{ pagination.page {%- capture venue -%} {% if concert.venue.name %} {% if concert.venue.latitude and concert.venue.longitude %} - {{ concert.venue.name | formatVenue }} + {{ concert.venue.name_short }} {% else %} - {{ concert.venue.name | formatVenue }} + {{ concert.venue.name_short }} {% endif %} {% endif %} {%- endcapture -%} diff --git a/views/media/music/artists.psql b/views/media/music/artists.psql index 348f2b62..49653d8d 100644 --- a/views/media/music/artists.psql +++ b/views/media/music/artists.psql @@ -41,6 +41,7 @@ SELECT 'id', c.id, 'date', c.date, 'venue_name', v.name, + 'venue_name_short', trim(split_part(v.name, ',', 1)), 'venue_latitude', v.latitude, 'venue_longitude', v.longitude, 'notes', c.notes @@ -65,9 +66,7 @@ SELECT SELECT json_agg(json_build_object( 'title', m.title, 'year', m.year, - 'url', m.slug, - 'rating', m.rating, - 'favorite', m.favorite + 'url', m.slug ) ORDER BY m.year DESC) FROM movies_artists ma LEFT JOIN movies m ON ma.movies_id = m.id diff --git a/views/media/music/concerts.psql b/views/media/music/concerts.psql index 7d9ed314..d4483e6d 100644 --- a/views/media/music/concerts.psql +++ b/views/media/music/concerts.psql @@ -3,10 +3,6 @@ SELECT c.id, c.date, c.notes, - 'I went to (yet another) concert!' AS description, - 'concert' AS type, - - CONCAT('/music/concerts?id=', c.id) AS url, CASE WHEN c.artist IS NOT NULL THEN @@ -23,6 +19,7 @@ SELECT json_build_object( 'name', v.name, + 'name_short', trim(split_part(v.name, ',', 1)), 'latitude', v.latitude, 'longitude', v.longitude, 'notes', v.notes