-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from QRAB-EWHA/feature/solved-quiz-review
feat: 특정 노트 solved 퀴즈 세트 조회 기능 생성
- Loading branch information
Showing
7 changed files
with
87 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,52 @@ | ||
package QRAB.QRAB.quiz.dto; | ||
|
||
import QRAB.QRAB.quiz.domain.QuizResult; | ||
import QRAB.QRAB.quiz.domain.QuizSet; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class QuizResultDTO { | ||
private Long quizSetId; | ||
private String noteTitle; | ||
private int totalQuestions; | ||
private String createdDate; | ||
private String solvedDate; | ||
private String createdAt; | ||
private String solvedAt; | ||
private String answerSummary; | ||
private String categoryName; | ||
private String parentCategoryName; | ||
|
||
public QuizResultDTO(String noteTitle, int totalQuestions, String createdDate, String solvedDate, String answerSummary, String categoryName, String parentCategoryName) { | ||
this.noteTitle = noteTitle; | ||
this.totalQuestions = totalQuestions; | ||
this.createdDate = createdDate; | ||
this.solvedDate = solvedDate; | ||
this.createdAt = createdAt; | ||
this.solvedAt = solvedAt; | ||
this.answerSummary = answerSummary; | ||
this.categoryName = categoryName; | ||
this.parentCategoryName = parentCategoryName; | ||
} | ||
|
||
public String getNoteTitle() { | ||
return noteTitle; | ||
} | ||
|
||
public void setNoteTitle(String noteTitle) { | ||
this.noteTitle = noteTitle; | ||
} | ||
|
||
public int getTotalQuestions() { | ||
return totalQuestions; | ||
public QuizResultDTO(QuizSet quizSet, QuizResult quizResult) { | ||
this.quizSetId = quizSet.getQuizSetId(); | ||
this.noteTitle = quizSet.getNote().getTitle(); | ||
this.totalQuestions = quizSet.getTotalQuestions(); | ||
this.createdAt = quizSet.getCreatedAt().toString(); | ||
this.solvedAt = quizResult.getTakenAt() != null ? quizResult.getTakenAt().toString() : null; | ||
this.answerSummary = generateAnswerSummary(quizResult); // 정답/오답 요약 생성 | ||
this.categoryName = quizSet.getNote().getCategory().getName(); | ||
this.parentCategoryName = quizSet.getNote().getCategory().getParentCategory() != null | ||
? quizSet.getNote().getCategory().getParentCategory().getName() | ||
: ""; | ||
} | ||
|
||
public void setTotalQuestions(int totalQuestions) { | ||
this.totalQuestions = totalQuestions; | ||
} | ||
private String generateAnswerSummary(QuizResult quizResult) { | ||
int correctCount = quizResult.getCorrectCount(); | ||
int totalQuestions = quizResult.getTotalQuestions(); | ||
int wrongCount = totalQuestions - correctCount; | ||
|
||
public String getCreatedDate() { | ||
return createdDate; | ||
} | ||
|
||
public void setCreatedDate(String createdDate) { | ||
this.createdDate = createdDate; | ||
} | ||
|
||
public String getSolvedDate() { | ||
return solvedDate; | ||
} | ||
|
||
public void setSolvedDate(String solvedDate) { | ||
this.solvedDate = solvedDate; | ||
} | ||
|
||
public String getAnswerSummary() { | ||
return answerSummary; | ||
} | ||
|
||
public void setAnswerSummary(String answerSummary) { | ||
this.answerSummary = answerSummary; | ||
} | ||
|
||
public String getCategoryName() { | ||
return categoryName; | ||
} | ||
|
||
public void setCategoryName(String categoryName) { | ||
this.categoryName = categoryName; | ||
} | ||
|
||
public String getParentCategoryName() { | ||
return parentCategoryName; | ||
} | ||
|
||
public void setParentCategoryName(String parentCategoryName) { | ||
this.parentCategoryName = parentCategoryName; | ||
return correctCount > wrongCount | ||
? "정답 " + correctCount + "문제" | ||
: "오답 " + wrongCount + "문제"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters