diff --git a/playground/src/components/details/editor/inline_feedback.tsx b/playground/src/components/details/editor/inline_feedback.tsx index 0d8b69ae4..7e5b16d29 100644 --- a/playground/src/components/details/editor/inline_feedback.tsx +++ b/playground/src/components/details/editor/inline_feedback.tsx @@ -190,7 +190,7 @@ export default function InlineFeedback({ ) : (
0 @@ -210,12 +210,19 @@ export default function InlineFeedback({ placeholder="Title..." onChange={(e) => setTitle(e.target.value)} /> - ) : ( + ) : feedback.title && ( - {feedback.title ? feedback.title : Missing title} + {feedback.title} )}
+ {feedback.structured_grading_instruction?.feedback && ( +
+ + {feedback.structured_grading_instruction.feedback} + +
+ )}
{isEditing && onFeedbackChange ? ( setDescription(e.target.value)} /> - ) : feedback.description ? ( + ) : feedback.description && ( {feedback.description} - ) : ( - Missing description )}
diff --git a/playground/src/hooks/playground/feedbacks.ts b/playground/src/hooks/playground/feedbacks.ts index a8c3f48d0..99ee5ea5c 100644 --- a/playground/src/hooks/playground/feedbacks.ts +++ b/playground/src/hooks/playground/feedbacks.ts @@ -15,7 +15,14 @@ export async function fetchFeedbacks( const response = await fetch( `${baseUrl}/api/data/${dataMode}/${exercise ? `exercise/${exercise.id}/` : ""}feedbacks` ); - const feedbacks = await response.json() as Feedback[]; + + let feedbacks = await response.json() as Feedback[]; + for (const feedback of feedbacks) { + if (feedback.structured_grading_instruction_id) { + feedback.structured_grading_instruction = exercise?.grading_criteria?.flatMap((criteria) => criteria.structured_grading_instructions).find((instruction) => instruction.id === feedback.structured_grading_instruction_id); + } + } + if (submission) { return feedbacks.filter((feedback) => feedback.submission_id === submission.id); } diff --git a/playground/src/model/feedback.ts b/playground/src/model/feedback.ts index 19b11d8a8..82ce4e4a6 100644 --- a/playground/src/model/feedback.ts +++ b/playground/src/model/feedback.ts @@ -1,5 +1,5 @@ import type { IRange, editor } from "monaco-editor"; -import type { ExerciseType } from "./exercise"; +import type { ExerciseType, StructuredGradingInstruction } from "./exercise"; import type { Submission } from "./submission"; type FeedbackBase = { @@ -11,6 +11,7 @@ type FeedbackBase = { exercise_id: number; submission_id: number; structured_grading_instruction_id?: number; + structured_grading_instruction?: StructuredGradingInstruction; // Playground only isSuggestion?: boolean; // Playground only isNew?: boolean; // Playground only isChanged?: boolean; // Playground only