struggle with conditional query

i have a query where i want to have a condtional filtering for userscores in a prediction but when i do so it dosnt have a effect on true or false. What am i doing wrong ?
{
where: {
id: { gte: cursor },
mode: 0,
userscore: input.displayOnlyUnplayedPredictions
? {
none: {
// Ensures that no Userscore related to this Prediction has the cified osu_user_id
AND: [
{
osu_user_id: ctx.session.user.osu_user_id,
},
{
accuracy: {
gte: input.displayOnlyUnplayedBeatmapsWithAcuuracyAbove,
},
},
],
},
}
: {},
}
}
{
where: {
id: { gte: cursor },
mode: 0,
userscore: input.displayOnlyUnplayedPredictions
? {
none: {
// Ensures that no Userscore related to this Prediction has the cified osu_user_id
AND: [
{
osu_user_id: ctx.session.user.osu_user_id,
},
{
accuracy: {
gte: input.displayOnlyUnplayedBeatmapsWithAcuuracyAbove,
},
},
],
},
}
: {},
}
}
if remove the condtion it works
Solution:
...(input.displayOnlyUnplayedPredictions && userscoreCondition),
Jump to solution
2 Replies
Solution
EnricoBaivo
EnricoBaivo4mo ago
...(input.displayOnlyUnplayedPredictions && userscoreCondition),
EnricoBaivo
EnricoBaivoOP4mo ago
!help MARK AS SOLVED PLEASE
Want results from more Discord servers?
Add your server