-
Notifications
You must be signed in to change notification settings - Fork 0
QCMs
github-actions[bot] edited this page Jul 25, 2026
·
1 revision
The Forms/QCMs module manages online assessments, questionnaires, and multi-choice quizzes (QCMs) assigned to students by teachers.
Here's how to fetch assigned quizzes, inspect their structures, and respond to questions.
import { getQcms, getQcmDetail } from "linkdirecte";
// 1. Fetch available quizzes
const result = await getQcms();
const activeQuiz = result.associations?.[0];
if (activeQuiz) {
console.log(`Let's work on: ${activeQuiz.titre || "Untitled Quiz"}`);
// 2. Fetch questions for this quiz
const details = await getQcmDetail(activeQuiz.idQcm, activeQuiz.id);
details.questions.forEach((question, index) => {
console.log(`Question ${index + 1}: ${question.libelle}`);
question.choices.forEach(choice => {
console.log(` [ ] ID: ${choice.id} | ${choice.libelle}`);
});
});
} else {
console.log("No quizzes assigned right now!");
}Retrieves a list of all assigned questionnaires/QCMs.
function getQcms(): Promise<QcmsResult>Retrieves the question set and candidate choices for a specific QCM.
function getQcmDetail(
idQcm: number,
idAssociation: number,
): Promise<QcmDetailResult>Updates the student's status on a quiz (e.g., when they start or complete it).
function updateQcmStatus(
idQcm: number,
idAssociation: number,
idParticipant: number,
action: "updateStartDate" | "updateEndDate",
): Promise<{ success: boolean }>-
idParticipant: Participant ID returned in the QCM details. -
action: Use"updateStartDate"when the student opens/starts the test, and"updateEndDate"when finalizing and submitting the complete exam.
Submits selected choice IDs for a single question.
function submitQcmAnswer(
params: {
idQcm: number;
idAssociation: number;
idParticipant: number;
idReponse: number;
idQuestion: number;
choiceIds: number[];
},
): Promise<{ success: boolean }>-
choiceIds: An array of numeric choice IDs the student selected for this question.
interface QcmsResult {
associations?: QcmEntry[];
}| Property | Type | Description |
|---|---|---|
id |
number |
The association ID. |
idQcm |
number |
The questionnaire ID. (raw key) |
titre |
string (optional)
|
Title of the test. (raw key) |
libelleMatiere |
string (optional)
|
Subject label. |
nomProf |
string (optional)
|
Teacher who assigned the QCM. |
date |
Date (optional)
|
The date when the quiz was assigned. |
status |
string (optional)
|
Quiz state (e.g. "Not Started", "In Progress"). |
interface QcmDetailResult {
idQcm: number;
questions: Array<{
id: number;
libelle: string; // (raw key)
choices: Array<{ id: number; libelle: string }>; // (raw key)
}>;
}© 2026 typeof (Scolup) | Licensed under AGPL 3.0