Skip to content
Extraits de code Groupes Projets
Valider 9eaff250 rédigé par Delphine van Rossum's avatar Delphine van Rossum Validation de Brieuc Dubois
Parcourir les fichiers

correction on surveys

parent fe8596df
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!22correction on surveys
......@@ -31,6 +31,13 @@
let subStep = $state(0);
let currentGroupId = $state(0);
survey.groups.sort((a, b) => {
//puts the demo questions first
if (a.demo === b.demo) {
return 0;
}
return a.demo ? -1 : 1;
});
let currentGroup = $derived(survey.groups[currentGroupId]);
let questionsRandomized = $derived(getSortedQuestions(currentGroup));
let currentQuestionId = $state(0);
......@@ -76,20 +83,22 @@
}
async function selectOption(option: string) {
if (
!(await sendSurveyResponseAPI(
fetch,
code,
sid,
uid,
survey.id,
currentGroupId,
questionsRandomized[currentQuestionId]['_id'],
currentQuestion.options.findIndex((o: string) => o === option) + 1,
(new Date().getTime() - startTime) / 1000
))
) {
return;
if (!currentGroup.demo) {
if (
!(await sendSurveyResponseAPI(
fetch,
code,
sid,
uid,
survey.id,
currentGroup.id,
questionsRandomized[currentQuestionId].id,
currentQuestion.options.findIndex((o: string) => o === option) + 1,
(new Date().getTime() - startTime) / 1000
))
) {
return;
}
}
if (currentQuestionId < questionsRandomized.length - 1) {
setQuestionId(currentQuestionId + 1);
......@@ -114,8 +123,8 @@
sid,
uid,
survey.id,
currentGroupId,
questionsRandomized[currentQuestionId]['_id'],
currentGroup.id,
questionsRandomized[currentQuestionId].id,
-1,
(new Date().getTime() - startTime) / 1000,
gapTexts
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter