From 84e56206dcd194e1a2e9cb5ab3c1dd109c1d870d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Tue, 6 Aug 2024 17:08:00 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20report=20=EC=A0=9C=EC=B6=9C=20=EB=B0=8F?= =?UTF-8?q?=20=EC=B1=84=EC=A0=90=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/report/entity/dto/ReportRequset.java | 2 +- .../edufocus/edufocus/report/entity/vo/Report.java | 6 +++--- .../edufocus/report/service/ReportServiceImpl.java | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java index e88a821..84e3e74 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java @@ -10,7 +10,7 @@ import java.util.List; public class ReportRequset { - List answerInputList; + List answer; // [1,2,,3] // List a diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index a9e2222..1b81e78 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -23,13 +23,13 @@ public class Report { private int allCount; private int correctCount; private Date testAt; - + private Long lectureId; @ManyToOne - @JoinColumn(name= "user_id") + @JoinColumn(name = "user_id") private User user; @ManyToOne - @JoinColumn(name= "quizset_id") + @JoinColumn(name = "quizset_id") private QuizSet quizSet; } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java index bbbc8aa..f2666bc 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java @@ -45,7 +45,7 @@ public class ReportServiceImpl implements ReportService { QuizSet quizSet = quizSetService.findQuizSet(quizsetId); List quizList = quizSet.getQuizzes(); - List answerInputList = reportRequset.getAnswerInputList(); + List answerInputList = reportRequset.getAnswer(); List answerList = new ArrayList<>(); @@ -56,19 +56,20 @@ public class ReportServiceImpl implements ReportService { for (int idx = 0; idx < answerInputList.size(); idx++) { Quiz quiz = quizList.get(idx); - AnswerInput inputAnswer = answerInputList.get(idx); + String inputAnswer = answerInputList.get(idx); Answer answer; - if (quiz.getAnswer().equals(inputAnswer.getAnswer())) { + // + if (quiz.getAnswer().equals(inputAnswer)) { correctCount++; answer = Answer.builder() - .userAnswer(inputAnswer.getAnswer()) + .userAnswer(inputAnswer) .isCorrect(true) .report(null) .quiz(quiz) .build(); } else { answer = Answer.builder() - .userAnswer(inputAnswer.getAnswer()) + .userAnswer(inputAnswer) .isCorrect(false) .report(null) .quiz(quiz)