Author: Adam <git@apiote.tk>
properly show previous film warning in watchlist
db/db.go | 6 +++---
diff --git a/db/db.go b/db/db.go index fa6d1944cacacc23d35b457f051c5f4f967e41f8..22a9ec1f6e0304f4a810ec57844f4097b4bad525 100644 --- a/db/db.go +++ b/db/db.go @@ -659,7 +659,7 @@ if filter != "" { whereClause = "and c1.title like '%" + filter + "%'" } - rows, err := db.Query(`select c1.item_id, c1.cover, c1.status, c1.title, c1.year_start, c1.based_on, c1.genres, c1.runtime, c1.part, c2.part from wantlist natural join item_cache c1 left join item_cache c2 on(c1.part-1 = c2.part and c1.collection = c2.collection) where c1.item_type = 'film' and username = ? `+whereClause+` order by c1.title limit ?,18`, username, offset) + rows, err := db.Query(`select distinct c1.item_id, c1.cover, c1.status, c1.title, c1.year_start, c1.based_on, c1.genres, c1.runtime, c1.part, c2.part from (wantlist w natural join item_cache c1) left join (experiences e natural join item_cache c2) on(c1.part-1 = c2.part and c1.collection = c2.collection and e.username = w.username) where c1.item_type = 'film' and w.username = ? `+whereClause+` order by c1.title limit ?,18`, username, offset) if err != nil { fmt.Fprintf(os.Stderr, "Select err: %v\n", err) @@ -678,8 +678,8 @@ fmt.Println("Scan error") return datastructure.Watchlist{}, err } - if prevPart != nil { - entry.HasPrevious = true // todo is not on watched + if entry.Part > 0 && prevPart == nil { + entry.HasPrevious = true } watchlist.List = append(watchlist.List, entry) }