From 99c369970c7c4ff8ea94fd26a7b752a4171f6842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20L=C3=B6fgren?= <viclo211@student.liu.se> Date: Thu, 29 Apr 2021 10:04:23 +0200 Subject: [PATCH] Add correcting instructions in frontend --- client/src/interfaces/ApiModels.ts | 1 + client/src/interfaces/ApiRichModels.ts | 1 + .../components/slideSettingsComponents/Instructions.tsx | 4 ++-- .../src/pages/views/components/JudgeScoringInstructions.tsx | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/interfaces/ApiModels.ts b/client/src/interfaces/ApiModels.ts index a6fa68a0..2734884b 100644 --- a/client/src/interfaces/ApiModels.ts +++ b/client/src/interfaces/ApiModels.ts @@ -56,6 +56,7 @@ export interface Question extends NameID { slide_id: number total_score: number type_id: number + correcting_instructions: string } export interface QuestionAlternative { diff --git a/client/src/interfaces/ApiRichModels.ts b/client/src/interfaces/ApiRichModels.ts index b9ca9f33..253565a4 100644 --- a/client/src/interfaces/ApiRichModels.ts +++ b/client/src/interfaces/ApiRichModels.ts @@ -36,5 +36,6 @@ export interface RichQuestion { total_score: number question_type: QuestionType type_id: number + correcting_instructions: string alternatives: QuestionAlternative[] } diff --git a/client/src/pages/presentationEditor/components/slideSettingsComponents/Instructions.tsx b/client/src/pages/presentationEditor/components/slideSettingsComponents/Instructions.tsx index 858dd75e..09279dae 100644 --- a/client/src/pages/presentationEditor/components/slideSettingsComponents/Instructions.tsx +++ b/client/src/pages/presentationEditor/components/slideSettingsComponents/Instructions.tsx @@ -30,7 +30,7 @@ const Instructions = ({ activeSlide, competitionId }: InstructionsProps) => { .put( `/api/competitions/${competitionId}/slides/${activeSlide.id}/questions/${activeSlide.questions[0].id}`, { - instructions: event.target.value, + correcting_instructions: event.target.value, } ) .then(() => { @@ -56,7 +56,7 @@ const Instructions = ({ activeSlide, competitionId }: InstructionsProps) => { <Center> <TextField id="outlined-basic" - defaultValue={''} + defaultValue={activeSlide.questions[0].correcting_instructions} onChange={updateInstructionsText} variant="outlined" fullWidth={true} diff --git a/client/src/pages/views/components/JudgeScoringInstructions.tsx b/client/src/pages/views/components/JudgeScoringInstructions.tsx index 3cc80319..1865ccf2 100644 --- a/client/src/pages/views/components/JudgeScoringInstructions.tsx +++ b/client/src/pages/views/components/JudgeScoringInstructions.tsx @@ -20,7 +20,7 @@ const JudgeScoringInstructions = ({ question }: JudgeScoringInstructionsProps) = return ( <JudgeScoringInstructionsContainer elevation={3}> <Typography variant="h4">Rättningsinstruktioner</Typography> - <Typography variant="body1">Såhär rättar du denhär frågan</Typography> + <Typography variant="body1">{question.correcting_instructions}</Typography> </JudgeScoringInstructionsContainer> ) } -- GitLab