From 094bac2471f5ae814fa8f874ff85ca20cb23501c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Fri, 21 Apr 2017 20:15:15 +0200 Subject: [PATCH 1/2] Fix wishlist's SQL queries for the shows --- src/internal/backend/show_wishlist.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/internal/backend/show_wishlist.go b/src/internal/backend/show_wishlist.go index 68d1e27..2024da4 100644 --- a/src/internal/backend/show_wishlist.go +++ b/src/internal/backend/show_wishlist.go @@ -15,20 +15,16 @@ const ( SET imdb_id=$1, user_id=$2, season=$3, episode=$4;` isShowWishlistedQueryByUserID = ` - SELECT - shows.imdb_id - FROM shows INNER JOIN shows_tracked - ON - shows.imdb_id=shows_tracked.imdb_id - AND - shows_tracked.user_id=$2 - WHERE shows.imdb_id=$1;` + SELECT s.imdb_id, t.season, t.episode + FROM shows s INNER JOIN shows_tracked t + ON s.imdb_id = t.imdb_id AND t.user_id=$2 + WHERE t.imdb_id=$1;` getShowWishlistQueryByUserID = ` - SELECT - shows.imdb_id, shows_tracked.season, shows_tracked.episode - FROM shows INNER JOIN shows_tracked - ON shows.imdb_id=shows_tracked.imdb_id AND shows_tracked.user_id=$1;` + SELECT s.imdb_id, t.season, t.episode + FROM shows s + INNER JOIN shows_tracked t + ON s.imdb_id = t.imdb_id AND t.user_id=$1;` deleteShowWishlistedQueryByID = `DELETE FROM shows_tracked WHERE imdb_id=$1 AND user_id=$2;` ) From 1f0c397f0a5729d20f81ec54422e3b01cb82596e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Sat, 22 Apr 2017 10:53:52 +0200 Subject: [PATCH 2/2] Add indicator for tracked content --- src/public/js/components/list/details.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/public/js/components/list/details.js b/src/public/js/components/list/details.js index 4ffdcb7..5b40c56 100644 --- a/src/public/js/components/list/details.js +++ b/src/public/js/components/list/details.js @@ -9,11 +9,30 @@ export default function ListDetails(props) { ).join(', '); } + let wishlistStr = ""; + if (props.data.wishlisted === true) { + wishlistStr = "Wishlisted"; + } + if (props.data.tracked_episode !== null && props.data.tracked_season != null) { + let season = props.data.tracked_season; + let episode = props.data.tracked_episode; + if ((season === 0) && (episode === 0)) { + wishlistStr = "Whole show tracked"; + } else { + wishlistStr = `Tracked from season ${season} episode ${episode}`; + } + } + return (
-
+

{props.data.title}

{props.data.title}

+ {wishlistStr !== "" && + + {wishlistStr} + + }

{props.data.year}

{props.data.runtime &&