From 245d56410d87901db53e0368929f1753cee0715c Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Alexandrovich Date: Thu, 27 Mar 2025 13:45:42 +0300 Subject: [PATCH] fix read students reactions --- src/__data__/model.ts | 2 +- src/pages/lesson-details.tsx | 6 +++--- stubs/mocks/lessons/access-code/create/success.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/__data__/model.ts b/src/__data__/model.ts index 2ad1c9a..bbf91dd 100644 --- a/src/__data__/model.ts +++ b/src/__data__/model.ts @@ -59,7 +59,7 @@ export interface Lesson { id: string; _id: string; name: string; - reactions: Reaction[]; + studentReactions: Reaction[]; students: User[]; teachers: Teacher[]; date: string; diff --git a/src/pages/lesson-details.tsx b/src/pages/lesson-details.tsx index ece73df..f04ceb9 100644 --- a/src/pages/lesson-details.tsx +++ b/src/pages/lesson-details.tsx @@ -127,8 +127,8 @@ const LessonDetail = () => { // Эффект для обработки новых реакций useEffect(() => { - if (accessCode?.body?.lesson?.reactions) { - const reactions = accessCode.body.lesson.reactions; + if (accessCode?.body?.lesson?.studentReactions) { + const reactions = accessCode.body.lesson.studentReactions; // Группируем реакции по sub (идентификатору студента) const groupedReactions: Record = {}; @@ -161,7 +161,7 @@ const LessonDetail = () => { return () => clearTimeout(clearReactionsTimeout); } - }, [accessCode?.body?.lesson?.reactions]); + }, [accessCode?.body?.lesson?.studentReactions]); useEffect(() => { if (manualAddRqst.isSuccess) { diff --git a/stubs/mocks/lessons/access-code/create/success.json b/stubs/mocks/lessons/access-code/create/success.json index 3d41cfd..56bc75b 100644 --- a/stubs/mocks/lessons/access-code/create/success.json +++ b/stubs/mocks/lessons/access-code/create/success.json @@ -27,7 +27,7 @@ "picture": "https://lh3.googleusercontent.com/a/ACg8ocJUtJBAVBm642AxoGpMDDMV8CPu3MEoLjU3hmO7oisG=s96-c" } ], - "reactions": [ + "studentReactions": [ { "_id": "r1d73f22-c9ba-422a-b572-c59e515a2901", "sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",