mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
No commits in common. "2ee787d179a712bcf0dea9344dc66dd16c350093" and "e50b3cee65462b841806c34df2cef5f3da055bf0" have entirely different histories.
2ee787d179
...
e50b3cee65
5 changed files with 5 additions and 32 deletions
|
|
@ -53,7 +53,7 @@ describe('TeacherModeQuiz', () => {
|
||||||
fireEvent.click(screen.getByText('Répondre'));
|
fireEvent.click(screen.getByText('Répondre'));
|
||||||
});
|
});
|
||||||
expect(mockSubmitAnswer).toHaveBeenCalledWith('Option A', 1);
|
expect(mockSubmitAnswer).toHaveBeenCalledWith('Option A', 1);
|
||||||
expect(screen.getByText('Votre réponse est:')).toBeInTheDocument();
|
expect(screen.getByText('Votre réponse est "Option A".')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handles disconnect button click', () => {
|
test('handles disconnect button click', () => {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ const GIFTTemplatePreview: React.FC<GIFTTemplatePreviewProps> = ({
|
||||||
<div className="error">{error}</div>
|
<div className="error">{error}</div>
|
||||||
) : isPreviewReady ? (
|
) : isPreviewReady ? (
|
||||||
<div data-testid="preview-container">
|
<div data-testid="preview-container">
|
||||||
|
|
||||||
<div dangerouslySetInnerHTML={{ __html: FormattedTextTemplate({ format: 'html', text: items }) }}></div>
|
<div dangerouslySetInnerHTML={{ __html: FormattedTextTemplate({ format: 'html', text: items }) }}></div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { TextFormat } from 'gift-pegjs';
|
||||||
import DOMPurify from 'dompurify'; // cleans HTML to prevent XSS attacks, etc.
|
import DOMPurify from 'dompurify'; // cleans HTML to prevent XSS attacks, etc.
|
||||||
|
|
||||||
function formatLatex(text: string): string {
|
function formatLatex(text: string): string {
|
||||||
|
|
||||||
let renderedText = '';
|
let renderedText = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import {
|
||||||
Switch,
|
Switch,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { StudentType } from '../../Types/StudentType';
|
import { StudentType } from '../../Types/StudentType';
|
||||||
|
|
||||||
import LiveResultsTable from './LiveResultsTable/LiveResultsTable';
|
import LiveResultsTable from './LiveResultsTable/LiveResultsTable';
|
||||||
|
|
||||||
|
|
||||||
interface LiveResultsProps {
|
interface LiveResultsProps {
|
||||||
socket: Socket | null;
|
socket: Socket | null;
|
||||||
questions: QuestionType[];
|
questions: QuestionType[];
|
||||||
|
|
@ -20,11 +20,11 @@ interface LiveResultsProps {
|
||||||
students: StudentType[]
|
students: StudentType[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const LiveResults: React.FC<LiveResultsProps> = ({ questions, showSelectedQuestion, students }) => {
|
const LiveResults: React.FC<LiveResultsProps> = ({ questions, showSelectedQuestion, students }) => {
|
||||||
const [showUsernames, setShowUsernames] = useState<boolean>(false);
|
const [showUsernames, setShowUsernames] = useState<boolean>(false);
|
||||||
const [showCorrectAnswers, setShowCorrectAnswers] = useState<boolean>(false);
|
const [showCorrectAnswers, setShowCorrectAnswers] = useState<boolean>(false);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="action-bar mb-1">
|
<div className="action-bar mb-1">
|
||||||
|
|
@ -56,7 +56,6 @@ const LiveResults: React.FC<LiveResultsProps> = ({ questions, showSelectedQuesti
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="table-container">
|
<div className="table-container">
|
||||||
|
|
||||||
<LiveResultsTable
|
<LiveResultsTable
|
||||||
students={students}
|
students={students}
|
||||||
questions={questions}
|
questions={questions}
|
||||||
|
|
|
||||||
|
|
@ -23,22 +23,8 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
||||||
}) => {
|
}) => {
|
||||||
const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false);
|
const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false);
|
||||||
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState(false);
|
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState(false);
|
||||||
const [feedbackMessage, setFeedbackMessage] = useState<React.ReactNode>('');
|
const [feedbackMessage, setFeedbackMessage] = useState('');
|
||||||
|
|
||||||
const renderFeedbackMessage = (answer: string) => {
|
|
||||||
|
|
||||||
if(answer === 'true' || answer === 'false'){
|
|
||||||
return (<span>
|
|
||||||
<strong>Votre réponse est: </strong>{answer==="true" ? 'Vrai' : 'Faux'}
|
|
||||||
</span>)
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return (
|
|
||||||
<span>
|
|
||||||
<strong>Votre réponse est: </strong>{answer.toString()}
|
|
||||||
</span>
|
|
||||||
);}
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Close the feedback dialog when the question changes
|
// Close the feedback dialog when the question changes
|
||||||
handleFeedbackDialogClose();
|
handleFeedbackDialogClose();
|
||||||
|
|
@ -49,7 +35,7 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
||||||
const handleOnSubmitAnswer = (answer: string | number | boolean) => {
|
const handleOnSubmitAnswer = (answer: string | number | boolean) => {
|
||||||
const idQuestion = Number(questionInfos.question.id) || -1;
|
const idQuestion = Number(questionInfos.question.id) || -1;
|
||||||
submitAnswer(answer, idQuestion);
|
submitAnswer(answer, idQuestion);
|
||||||
setFeedbackMessage(renderFeedbackMessage(answer.toString()));
|
setFeedbackMessage(`Votre réponse est "${answer.toString()}".`);
|
||||||
setIsFeedbackDialogOpen(true);
|
setIsFeedbackDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -91,17 +77,7 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
||||||
>
|
>
|
||||||
<DialogTitle>Rétroaction</DialogTitle>
|
<DialogTitle>Rétroaction</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div style={{
|
|
||||||
wordWrap: 'break-word',
|
|
||||||
whiteSpace: 'pre-wrap',
|
|
||||||
maxHeight: '400px',
|
|
||||||
overflowY: 'auto',
|
|
||||||
}}>
|
|
||||||
{feedbackMessage}
|
{feedbackMessage}
|
||||||
<div style={{ textAlign: 'left', fontWeight: 'bold', marginTop: '10px'}}
|
|
||||||
>Question : </div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<QuestionComponent
|
<QuestionComponent
|
||||||
handleOnSubmitAnswer={handleOnSubmitAnswer}
|
handleOnSubmitAnswer={handleOnSubmitAnswer}
|
||||||
question={questionInfos.question as Question}
|
question={questionInfos.question as Question}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue