diff --git a/api/src/controllers/profiles/history.ts b/api/src/controllers/profiles/history.ts index b4cedfcc..2104baa9 100644 --- a/api/src/controllers/profiles/history.ts +++ b/api/src/controllers/profiles/history.ts @@ -428,8 +428,8 @@ export const historyH = new Elysia({ tags: ["profiles"] }) query, sort, filter: and( - isNotNull(entryProgressQ.playedDate), - eq(entryProgressQ.external, false), + isNotNull(historyProgressQ.playedDate), + eq(historyProgressQ.external, false), ne(entries.kind, "extra"), filter, ), diff --git a/api/src/controllers/profiles/nextup.ts b/api/src/controllers/profiles/nextup.ts index 8107f4bd..2ecba848 100644 --- a/api/src/controllers/profiles/nextup.ts +++ b/api/src/controllers/profiles/nextup.ts @@ -2,7 +2,7 @@ import { and, eq, isNotNull, lt, or, sql } from "drizzle-orm"; import Elysia, { t } from "elysia"; import { auth } from "~/auth"; import { db } from "~/db"; -import { entries } from "~/db/schema"; +import { entries, profiles } from "~/db/schema"; import { watchlist } from "~/db/schema/watchlist"; import { getColumns } from "~/db/utils"; import { Entry } from "~/models/entry"; @@ -113,11 +113,13 @@ export const nextup = new Elysia({ tags: ["profiles"] }) }) .from(entries) .innerJoin(watchlist, eq(watchlist.nextEntry, entries.pk)) + .innerJoin(profiles, eq(watchlist.profilePk, profiles.pk)) .innerJoin(transQ, eq(entries.pk, transQ.pk)) .crossJoinLateral(entryVideosQ) .leftJoin(entryProgressQ, eq(entries.pk, entryProgressQ.entryPk)) .where( and( + eq(profiles.id, sub), or( lt(entries.airDate, sql`now()`), isNotNull(entries.availableSince),