Skip to content

Commit be4186c

Browse files
Merge branch 'develop' into chore/update-log-viewer-dependencies
2 parents f8e500d + 7082cec commit be4186c

File tree

18 files changed

+48
-39
lines changed

18 files changed

+48
-39
lines changed

playground/public/continue_later.mp4

674 KB
Binary file not shown.
2.44 MB
Binary file not shown.
538 KB
Binary file not shown.
761 KB
Binary file not shown.

playground/public/read_submission.mp4

992 KB
Binary file not shown.

playground/public/view_next.mp4

473 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

playground/src/components/expert_evaluation/expert_view/exercise_screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function ExerciseScreen(exerciseScreenProps: ExerciseScreenProps)
4343
continue later. Your progress has been saved.
4444
</p>
4545
<p className="text-lg mb-6">
46-
When you are ready, continue with the next exercise: {exercise.title}.
46+
When you are ready, continue with the next exercise: <strong>{exercise.title}</strong>.
4747
</p>
4848
<div className="flex justify-center mt-4">
4949
<SecondaryButton

playground/src/components/expert_evaluation/expert_view/tutorial_popup.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import React, { useState } from 'react';
1+
import React, {useState} from 'react';
22
import Popup from "@/components/expert_evaluation/expert_view/popup";
3-
import exerciseDetails from "@/assets/evaluation_tutorial/exercise_details.gif";
4-
import readSubmission from "@/assets/evaluation_tutorial/read_submission.gif";
5-
import evaluateMetrics from "@/assets/evaluation_tutorial/evaluate_metrics.gif";
6-
import metricsExplanation from "@/assets/evaluation_tutorial/metrics-explanation.gif";
7-
import viewNext from "@/assets/evaluation_tutorial/view-next.gif";
8-
import continueLater from "@/assets/evaluation_tutorial/continue_later.gif";
93
import {
104
InfoIconButton,
115
NextButton,
@@ -17,24 +11,24 @@ import ExerciseDetail from "@/components/details/exercise_detail";
1711

1812
const baseTutorialSteps = [
1913
{
20-
image: exerciseDetails.src,
14+
src: "/playground/exercise_details.mp4",
2115
description: (
2216
<>
2317
1. Read the
24-
<SecondaryButton text={'📄 Exercise Details'} isInline={true} className="mx-1" />
18+
<SecondaryButton text={'📄 Exercise Details'} isInline={true} className="mx-1"/>
2519
</>
2620
),
2721
},
2822
{
29-
image: readSubmission.src,
23+
src: "/playground/read_submission.mp4",
3024
description: "2. Read the Submission and the corresponding feedback"
3125
},
3226
{
33-
image: evaluateMetrics.src,
27+
src: "/playground/evaluation_metrics.mp4",
3428
description: "3. Evaluate the feedback based on the metrics"
3529
},
3630
{
37-
image: metricsExplanation.src,
31+
src: "/playground/metrics_explanation.mp4",
3832
description: (
3933
<>
4034
4. If unsure what a metric means, press the
@@ -45,15 +39,15 @@ const baseTutorialSteps = [
4539
),
4640
},
4741
{
48-
image: viewNext.src,
42+
src: "/playground/view_next.mp4",
4943
description: (
5044
<>
5145
5. After evaluating all metrics for all feedbacks, click on the
5246
<NextButton isInline={true} className="mx-1" /> button to view the next submission.
5347
</>),
5448
},
5549
{
56-
image: continueLater.src,
50+
src: "/playground/continue_later.mp4",
5751
description: (
5852
<>
5953
6. When you are ready to take a break, click on the
@@ -79,7 +73,7 @@ export default function TutorialPopup(tutorialPopupProps: TutorialPopupProps) {
7973
? [
8074
...baseTutorialSteps,
8175
{
82-
image: "",
76+
src: "",
8377
description: (
8478
<>
8579
<div className="text-left">
@@ -104,15 +98,19 @@ export default function TutorialPopup(tutorialPopupProps: TutorialPopupProps) {
10498
}
10599
};
106100

107-
const { image, description } = tutorialSteps[currentStep];
101+
const {src, description} = tutorialSteps[currentStep];
108102

109103
const isLastStep = currentStep === tutorialSteps.length - 1;
110104
return (
111105
<Popup isOpen={isOpen} onClose={onClose} title="Evaluation Tutorial"
112-
disableCloseOnOutsideClick={disableCloseOnOutsideClick}>
106+
disableCloseOnOutsideClick={disableCloseOnOutsideClick}>
113107
<div className="text-center">
114-
{/* Display the current GIF */}
115-
{image && <img src={image} alt={`Tutorial Step ${currentStep + 1}`} className="w-full h-auto mb-4" />}
108+
{/* Display the current video */}
109+
{src &&
110+
<video key={src} controls autoPlay className="mb-4">
111+
<source src={src} type="video/mp4"/>
112+
Your browser does not support the video tag.
113+
</video>}
116114

117115
{/* Render the description directly, which may include text and button */}
118116
<div className={"text-lg mb-4"}>

playground/src/components/view_mode/evaluation_mode/expert_evaluation/evaluation_management.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function EvaluationManagement() {
6666
return newConfig;
6767
};
6868

69-
const saveExpertEvaluationConfig = (configToSave = selectedConfig) => {
69+
const saveExpertEvaluationConfig = (configToSave = selectedConfig, isAnonymize = false) => {
7070
const isNewConfig = configToSave.id === "new";
7171
const newConfig = isNewConfig ? { ...configToSave, id: uuidv4() } : configToSave;
7272
setExpertEvaluationConfigs((prevConfigs) => {
@@ -81,7 +81,7 @@ export default function EvaluationManagement() {
8181
});
8282

8383
setSelectedConfig(newConfig);
84-
externalSaveExpertEvaluationConfig(dataMode, newConfig, isNewConfig);
84+
externalSaveExpertEvaluationConfig(dataMode, newConfig, isAnonymize);
8585
setHasUnsavedChanges(false);
8686
};
8787

@@ -122,7 +122,7 @@ export default function EvaluationManagement() {
122122
const startEvaluation = () => {
123123
if (confirm("Are you sure you want to start the evaluation? Once started, you can add new expert links but no other changes can be made to the configuration!")) {
124124
const updatedConfig = updateSelectedConfig({ started: true });
125-
saveExpertEvaluationConfig(updatedConfig);
125+
saveExpertEvaluationConfig(updatedConfig, true);
126126
}
127127
};
128128

playground/src/helpers/get_data.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,18 @@ export function anonymizeFeedbackCategoriesAndShuffle(
364364
export function saveConfigToFileSync(
365365
dataMode: DataMode,
366366
expertEvaluation: ExpertEvaluationConfig,
367-
) {
368-
const configData = JSON.stringify(expertEvaluation, null, 2);
367+
isAddExpertLinksAfterStart = false
368+
){
369+
370+
if (isAddExpertLinksAfterStart) {
371+
let config = getConfigFromFileSync(dataMode, expertEvaluation.id);
372+
if (config && config.expertIds) {
373+
config.expertIds = expertEvaluation.expertIds;
374+
expertEvaluation = config;
375+
}
376+
}
377+
378+
let configData = JSON.stringify(expertEvaluation, null, 2);
369379

370380
const configPath = path.join(
371381
process.cwd(),
@@ -410,7 +420,8 @@ export function saveConfigToFileSync(
410420
}
411421

412422
// Create or update config file with exercises and data
413-
return fs.writeFileSync(configPath, configData, 'utf8');
423+
fs.writeFileSync(configPath, configData, 'utf8');
424+
return configData;
414425
}
415426

416427
export function getProgressStatsFromFileSync(

playground/src/hooks/playground/expert_evaluation_config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { DataMode } from "@/model/data_mode";
66
export async function saveExpertEvaluationConfig(
77
dataMode: DataMode,
88
config: ExpertEvaluationConfig,
9-
isCreate: boolean) {
9+
isAnonymize: boolean) {
1010

11-
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${config.id}/config`, {
12-
method: isCreate ? 'POST' : 'PUT',
11+
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${config.id}/config?isAnonymize=${isAnonymize}`, {
12+
method: 'POST',
1313
headers: { "Content-Type": "application/json" },
1414
body: JSON.stringify(config),
1515
});

playground/src/pages/api/data/[dataMode]/expert_evaluation/[expertEvaluationId]/config.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import { ExpertEvaluationConfig } from "@/model/expert_evaluation_config";
1111

1212
function handler(req: NextApiRequest, res: NextApiResponse) {
1313
if (req.method == 'POST') {
14-
const { dataMode } = req.query as { dataMode: DataMode };
14+
const { dataMode, isAnonymize } = req.query as { dataMode: DataMode, isAnonymize: string };
1515
const expertEvaluationConfig: ExpertEvaluationConfig = req.body;
1616

17-
anonymizeFeedbackCategoriesAndShuffle(expertEvaluationConfig);
18-
saveConfigToFileSync(dataMode, expertEvaluationConfig);
19-
return res.status(200).json({ message: 'Config created successfully' });
17+
if (isAnonymize == "true") {
18+
anonymizeFeedbackCategoriesAndShuffle(expertEvaluationConfig);
19+
saveConfigToFileSync(dataMode, expertEvaluationConfig);
2020

21-
} else if (req.method == 'PUT') {
22-
const { dataMode } = req.query as { dataMode: DataMode };
23-
const expertEvaluationConfig: ExpertEvaluationConfig = req.body;
21+
// Add expert links after the evaluation has already started
22+
} else {
23+
saveConfigToFileSync(dataMode, expertEvaluationConfig, expertEvaluationConfig.started);
24+
}
2425

25-
saveConfigToFileSync(dataMode, expertEvaluationConfig);
26-
return res.status(200).json({ message: 'Config saved successfully' });
26+
return res.status(200).json({expertEvaluationConfig});
2727

2828
} else if (req.method == 'GET') {
2929
const { dataMode, expertEvaluationId } = req.query as { dataMode: DataMode; expertEvaluationId: string };
@@ -33,7 +33,7 @@ function handler(req: NextApiRequest, res: NextApiResponse) {
3333
return res.status(200).json(config);
3434
} else {
3535
res.setHeader('Allow', ['POST']);
36-
return res.status(405).json({ message: 'Only GET, POST and PUT requests allowed' });
36+
return res.status(405).json({ message: 'Only GET and POST requests allowed' });
3737
}
3838
}
3939

0 commit comments

Comments
 (0)