Compare commits

...

10 commits

Author SHA1 Message Date
Christopher (Cris) Fuhrman
6f270b5436
Merge pull request #198 from ets-cfuhrman-pfe/JubaAzul/issue197
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Has been cancelled
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Has been cancelled
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Has been cancelled
Tests / tests (client) (push) Has been cancelled
Tests / tests (server) (push) Has been cancelled
Juba azul/issue197
2025-01-22 20:55:08 -05:00
Christopher (Cris) Fuhrman
4b133400d4
Merge pull request #205 from ets-cfuhrman-pfe/JubaAzul/issue145
Juba azul/issue145
2025-01-22 20:49:54 -05:00
Christopher (Cris) Fuhrman
70e74e2342
Merge pull request #206 from ets-cfuhrman-pfe/JubaAzul/issue74
Update editorQuiz.css
2025-01-22 20:48:13 -05:00
JubaAzul
da4e54534e Update editorQuiz.css 2025-01-22 16:46:09 -05:00
JubaAzul
5018625693 Fix tests 2025-01-22 16:06:23 -05:00
JubaAzul
22f988f2ad Confusion avec la navigation dans les questions à rythme de l'enseignant
Fixes #145
2025-01-22 15:28:45 -05:00
JubaAzul
3e9152fa5c Confusion avec la navigation dans les questions à rythme de l'enseignant
Fixes #145
2025-01-21 15:35:07 -05:00
JubaAzul
394bcf8bc4 enlever modifications de eslint 2025-01-20 12:23:02 -05:00
JubaAzul
70bad72350 Update eslint.config.js 2025-01-20 12:17:50 -05:00
JubaAzul
0a6383b2ec Exemples (copiés) ne sont pas valides et les directives ne sont pas bonnes
Fixes #197
2025-01-20 12:16:21 -05:00
6 changed files with 39 additions and 41 deletions

View file

@ -77,21 +77,5 @@ describe('StudentModeQuiz', () => {
}); });
test('navigates to the previous question', async () => {
act(() => {
fireEvent.click(screen.getByText('Option A'));
});
act(() => {
fireEvent.click(screen.getByText('Répondre'));
});
act(() => {
fireEvent.click(screen.getByText('Question précédente'));
});
expect(screen.getByText('Sample Question 1')).toBeInTheDocument();
expect(screen.getByText('Option B')).toBeInTheDocument();
});
}); });

View file

@ -21,11 +21,11 @@ const GiftCheatSheet: React.FC = () => {
}; };
const QuestionVraiFaux = "2+2 \\= 4 ? {T\n}// Utilisez les valeurs {T}, {F}, {TRUE} et {FALSE}"; const QuestionVraiFaux = "2+2 \\= 4 ? {T}\n// Utilisez les valeurs {T}, {F}, {TRUE} \net {FALSE}.";
const QuestionChoixMul = "Quelle ville est la capitale du Canada? {\n~ Toronto\n~ Montréal\n= Ottawa #Bonne réponse!\n}// La bonne réponse est Ottawa"; const QuestionChoixMul = "Quelle ville est la capitale du Canada? {\n~ Toronto\n~ Montréal\n= Ottawa #Bonne réponse!\n}\n// La bonne réponse est Ottawa";
const QuestionChoixMulMany = "Quelles villes trouve-t-on au Canada? { \n~ %33.3% Montréal \n ~ %33.3% Ottawa \n ~ %33.3% Vancouver \n ~ %-100% New York \n ~ %-100% Paris \n#### La bonne réponse est Montréal, Ottawa et Vancouver \n}\n// Utilisez le signe ~ pour toutes les réponses.\n// On doit indiquer le pourcentage de chaque réponse."; const QuestionChoixMulMany = "Quelles villes trouve-t-on au Canada? { \n~ %33.3% Montréal \n ~ %33.3% Ottawa \n ~ %33.3% Vancouver \n ~ %-100% New York \n ~ %-100% Paris \n#### La bonne réponse est Montréal, Ottawa et Vancouver \n}\n/ Utilisez tilde (signe de vague) pour toutes les réponses.\n// On doit indiquer le pourcentage de chaque réponse.";
const QuestionCourte ="Avec quoi ouvre-t-on une porte? { \n= clé \n= clef \n}\n// Permet de fournir plusieurs bonnes réponses.\n// Note: La casse n'est pas prise en compte."; const QuestionCourte ="Avec quoi ouvre-t-on une porte? { \n= clé \n= clef \n}\n/ Permet de fournir plusieurs bonnes réponses.\n// Note: La casse n'est pas prise en compte.";
const QuestionNum ="Question {#=Nombre\n} //OU \nQuestion {#=Nombre:Tolérance\n} // OU \nQuestion {#=PetitNombre..GrandNombre\n}\n// La tolérance est un pourcentage.\n// La réponse doit être comprise entre PetitNombre et GrandNombre"; const QuestionNum ="// Question de plage mathématique. \n Quel est un nombre de 1 à 5 ? {\n#3:2\n}\n \n// Plage mathématique spécifiée avec des points de fin d'intervalle. \n Quel est un nombre de 1 à 5 ? {\n#1..5\n} \n\n// Réponses numériques multiples avec crédit partiel et commentaires.\nQuand est né Ulysses S. Grant ? {\n# =1822:0 # Correct ! Crédit complet. \n=%50%1822:2 # Il est né en 1822. Demi-crédit pour être proche.\n}";
return ( return (
<div className="gift-cheat-sheet"> <div className="gift-cheat-sheet">
<h2 className="subtitle">Informations pratiques sur l&apos;éditeur</h2> <h2 className="subtitle">Informations pratiques sur l&apos;éditeur</h2>

View file

@ -23,6 +23,7 @@ interface Props {
} }
const MultipleChoiceQuestion: React.FC<Props> = (props) => { const MultipleChoiceQuestion: React.FC<Props> = (props) => {
const { questionStem: questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const { questionStem: questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props;
const [answer, setAnswer] = useState<string>(); const [answer, setAnswer] = useState<string>();
@ -73,7 +74,9 @@ const MultipleChoiceQuestion: React.FC<Props> = (props) => {
{globalFeedback && showAnswer && ( {globalFeedback && showAnswer && (
<div className="global-feedback mb-2">{globalFeedback}</div> <div className="global-feedback mb-2">{globalFeedback}</div>
)} )}
{!showAnswer && handleOnSubmitAnswer && ( {!showAnswer && handleOnSubmitAnswer && (
<Button <Button
variant="contained" variant="contained"
onClick={() => onClick={() =>
@ -82,6 +85,7 @@ const MultipleChoiceQuestion: React.FC<Props> = (props) => {
disabled={answer === undefined} disabled={answer === undefined}
> >
Répondre Répondre
</Button> </Button>
)} )}
</div> </div>

View file

@ -1,13 +1,12 @@
// StudentModeQuiz.tsx // StudentModeQuiz.tsx
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import QuestionComponent from '../Questions/Question'; import QuestionComponent from '../Questions/Question';
import '../../pages/Student/JoinRoom/joinRoom.css'; import '../../pages/Student/JoinRoom/joinRoom.css';
import { QuestionType } from '../../Types/QuestionType'; import { QuestionType } from '../../Types/QuestionType';
// import { QuestionService } from '../../services/QuestionService'; // import { QuestionService } from '../../services/QuestionService';
import { Button } from '@mui/material'; import { Button } from '@mui/material';
import QuestionNavigation from '../QuestionNavigation/QuestionNavigation'; //import QuestionNavigation from '../QuestionNavigation/QuestionNavigation';
import { ChevronLeft, ChevronRight } from '@mui/icons-material'; //import { ChevronLeft, ChevronRight } from '@mui/icons-material';
import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton'; import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton';
interface StudentModeQuizProps { interface StudentModeQuizProps {
@ -25,10 +24,10 @@ const StudentModeQuiz: React.FC<StudentModeQuizProps> = ({
const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false); const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false);
// const [imageUrl, setImageUrl] = useState(''); // const [imageUrl, setImageUrl] = useState('');
const previousQuestion = () => { // const previousQuestion = () => {
setQuestion(questions[Number(questionInfos.question?.id) - 2]); // setQuestion(questions[Number(questionInfos.question?.id) - 2]);
setIsAnswerSubmitted(false); // setIsAnswerSubmitted(false);
}; // };
useEffect(() => {}, [questionInfos]); useEffect(() => {}, [questionInfos]);
@ -55,12 +54,12 @@ const StudentModeQuiz: React.FC<StudentModeQuizProps> = ({
<div className="overflow-auto"> <div className="overflow-auto">
<div className="question-component-container"> <div className="question-component-container">
<div className="mb-5"> <div className="mb-5">
<QuestionNavigation {/* <QuestionNavigation
currentQuestionId={Number(questionInfos.question.id)} currentQuestionId={Number(questionInfos.question.id)}
questionsLength={questions.length} questionsLength={questions.length}
previousQuestion={previousQuestion} previousQuestion={previousQuestion}
nextQuestion={nextQuestion} nextQuestion={nextQuestion}
/> /> */}
</div> </div>
<QuestionComponent <QuestionComponent
handleOnSubmitAnswer={handleOnSubmitAnswer} handleOnSubmitAnswer={handleOnSubmitAnswer}
@ -69,7 +68,7 @@ const StudentModeQuiz: React.FC<StudentModeQuizProps> = ({
/> />
<div className="center-h-align mt-1/2"> <div className="center-h-align mt-1/2">
<div className="w-12"> <div className="w-12">
<Button {/* <Button
variant="outlined" variant="outlined"
onClick={previousQuestion} onClick={previousQuestion}
fullWidth fullWidth
@ -77,14 +76,14 @@ const StudentModeQuiz: React.FC<StudentModeQuizProps> = ({
disabled={Number(questionInfos.question.id) <= 1} disabled={Number(questionInfos.question.id) <= 1}
> >
Question précédente Question précédente
</Button> </Button> */}
</div> </div>
<div className="w-12"> <div className="w-12">
<Button <Button style={{ display: isAnswerSubmitted ? 'block' : 'none' }}
variant="outlined" variant="outlined"
onClick={nextQuestion} onClick={nextQuestion}
fullWidth fullWidth
endIcon={<ChevronRight />} //endIcon={<ChevronRight />}
disabled={Number(questionInfos.question.id) >= questions.length} disabled={Number(questionInfos.question.id) >= questions.length}
> >
Question suivante Question suivante
@ -93,7 +92,7 @@ const StudentModeQuiz: React.FC<StudentModeQuizProps> = ({
</div> </div>
</div> </div>
</div> </div>
</div> </div>
); );
}; };

View file

@ -22,6 +22,7 @@
.quizEditor .editSection { .quizEditor .editSection {
width: 100%; width: 100%;
height: 78vh;
display: flex; display: flex;
} }

View file

@ -17,7 +17,7 @@ import LoadingCircle from 'src/components/LoadingCircle/LoadingCircle';
import { Refresh, Error } from '@mui/icons-material'; import { Refresh, Error } from '@mui/icons-material';
import StudentWaitPage from 'src/components/StudentWaitPage/StudentWaitPage'; import StudentWaitPage from 'src/components/StudentWaitPage/StudentWaitPage';
import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton'; import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton';
import QuestionNavigation from 'src/components/QuestionNavigation/QuestionNavigation'; //import QuestionNavigation from 'src/components/QuestionNavigation/QuestionNavigation';
import Question from 'src/components/Questions/Question'; import Question from 'src/components/Questions/Question';
import ApiService from '../../../services/ApiService'; import ApiService from '../../../services/ApiService';
@ -267,7 +267,6 @@ const ManageRoom: React.FC = () => {
const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1 const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1
if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return; if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return;
setCurrentQuestion(quizQuestions[prevQuestionIndex]); setCurrentQuestion(quizQuestions[prevQuestionIndex]);
webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]); webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]);
}; };
@ -461,12 +460,12 @@ const ManageRoom: React.FC = () => {
{quizMode === 'teacher' && ( {quizMode === 'teacher' && (
<div className="mb-1"> <div className="mb-1">
<QuestionNavigation {/* <QuestionNavigation
currentQuestionId={Number(currentQuestion?.question.id)} currentQuestionId={Number(currentQuestion?.question.id)}
questionsLength={quizQuestions?.length} questionsLength={quizQuestions?.length}
previousQuestion={previousQuestion} previousQuestion={previousQuestion}
nextQuestion={nextQuestion} nextQuestion={nextQuestion}
/> /> */}
</div> </div>
)} )}
@ -493,12 +492,23 @@ const ManageRoom: React.FC = () => {
</div> </div>
{quizMode === 'teacher' && ( {quizMode === 'teacher' && (
<div className="questionNavigationButtons" style={{ display: 'flex', justifyContent: 'center' }}>
<div className="previousQuestionButton">
<Button onClick={previousQuestion}
variant="contained"
disabled={Number(currentQuestion?.question.id) <= 1}>
Question précédente
</Button>
</div>
<div className="nextQuestionButton"> <div className="nextQuestionButton">
<Button onClick={nextQuestion} variant="contained"> <Button onClick={nextQuestion}
variant="contained"
disabled={Number(currentQuestion?.question.id) >=quizQuestions.length}
>
Prochaine question Prochaine question
</Button> </Button>
</div> </div>
)} </div> )}
</div> </div>