EnricoBaivo
EnricoBaivo
Explore posts from servers
PPrisma
Created by EnricoBaivo on 7/30/2024 in #help-and-questions
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
5 replies