Skip to content

Commit

Permalink
fix(gql): subject episodes overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Oct 26, 2024
1 parent 568672e commit 613a4a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/graphql/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ export const resolvers = {
.where('t.subjectID = :s', { s: parent.id })
.getCount();

offset = count + offset;
if (count === 0) {
return [];
}

// if count == 1, offset == -2, offset should be 0
offset = Math.max(count + offset, 0);
}

let s = repo.Episode.createQueryBuilder('t')
Expand Down

0 comments on commit 613a4a5

Please sign in to comment.