Open Nottommy11 opened 11 months ago
Can we do this by just having a single query variable that looks for the level, like this
async function getQuestionsCount() {
try {
const myres = client.query({
Method: 'POST',
query: gql query getQuestionsCount($netLvl: Int) { net_questions_aggregate(where: {net_level: {_eq: $netLvl}}){ aggregate { count } } }
,
variables: {
netLvl: netLvl
}
});
return (await myres).data.net_questions_aggregate.aggregate.count;
} catch (err) {
console.log(err);
}
}
Navigate to the
+page.svelte
in Quizzes.Optimize the queries in the getQuestionsCount and getQuestions functions so they are easier to read and use the netLvl variable to make the queries.
Here is an example:
So basically, we don't want to use the if statements checking netLvl anymore.