Skip to content

Commit

Permalink
fix: another band aid
Browse files Browse the repository at this point in the history
  • Loading branch information
bendevnull committed Aug 3, 2024
1 parent cf3d625 commit d4bf630
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/lib/riitag/neo/std/Covers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,8 @@ export default class Covers extends ModuleBase {
}
},
select: {
playlog_id: true,
game: {
select: {
game_id: true,
console: true
}
}
game_pk: true,
playlog_id: true
},
orderBy: {
played_on: 'desc'
Expand All @@ -220,18 +215,44 @@ export default class Covers extends ModuleBase {
}

for (const entry of playlog) {
if (!entry.game || entry.game.console === CONSOLE.THREEDS || entry.game.console === CONSOLE.SWITCH) {
const doesntmatter = await prisma.game.findFirst({
where: {
game_pk: entry.game_pk
}
})
if (!doesntmatter || doesntmatter.console === CONSOLE.THREEDS) {
await prisma.playlog.delete({
where: {
playlog_id: entry.playlog_id
playlog_id: entry.playlog_id
}
})
}
}

const otherPlaylog = await prisma.playlog.findMany({
where: {
user: {
id: user.id
}
},
select: {
game: {
select: {
console: true,
game_id: true
}
}
},
orderBy: {
played_on: 'desc'
},
distinct: ['game_pk'],
take: this.max
})

const coverPaths = []

for (const logEntry of playlog) {
for (const logEntry of otherPlaylog) {
coverPaths.push(this.getCover(
logEntry.game.console,
user.cover_type,
Expand Down

0 comments on commit d4bf630

Please sign in to comment.