Fix nextup profile mismatch (#1430)

This commit is contained in:
Zoe Roux 2026-04-06 18:23:00 +02:00 committed by GitHub
parent a27fd847c9
commit 52dfacf8db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -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,
),

View File

@ -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),