diff --git a/application/src/main/java/com/comssa/api/question/service/rest/common/QuestionClassifyByCategoryService.java b/application/src/main/java/com/comssa/api/question/service/rest/common/QuestionClassifyByCategoryService.java index b76a379..9429153 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/common/QuestionClassifyByCategoryService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/common/QuestionClassifyByCategoryService.java @@ -10,6 +10,6 @@ @Service public interface QuestionClassifyByCategoryService { - Map> classifyQuestionByCategoryOrdered(List questions); + Map> classifyQuestionByCategoryOrdered(List questions); } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/license/LicenseQuestionGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/license/LicenseQuestionGetService.java index 8dc2d3c..87d2a16 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/license/LicenseQuestionGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/license/LicenseQuestionGetService.java @@ -10,6 +10,6 @@ @Service public interface LicenseQuestionGetService { - Map> getClassifiedLicenseMultipleChoiceQuestion( - Long sessionId); + Map> getClassifiedLicenseMultipleChoiceQuestion( + Long sessionId); } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/license/implement/AdminLicenseQuestionGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/license/implement/AdminLicenseQuestionGetService.java index fb74cdf..4aab662 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/license/implement/AdminLicenseQuestionGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/license/implement/AdminLicenseQuestionGetService.java @@ -19,19 +19,19 @@ @RequiredArgsConstructor public class AdminLicenseQuestionGetService implements LicenseQuestionGetService { - private final LicenseMultipleChoiceQuestionDslRepository licenseMultipleChoiceQuestionDslRepository; - private final QuestionClassifyByCategoryService questionClassifyByCategoryService; + private final LicenseMultipleChoiceQuestionDslRepository licenseMultipleChoiceQuestionDslRepository; + private final QuestionClassifyByCategoryService questionClassifyByCategoryService; - /** - * 관리자 조회시 허용 여부와 관련 없이 모든 문제를 가져온다. - * 문제지도 섞지 않는다. - * 허용 여부 순대로 섞는다 - */ - @Override - public Map> getClassifiedLicenseMultipleChoiceQuestion( - Long sessionId) { - List licenseMultipleChoiceQuestions = licenseMultipleChoiceQuestionDslRepository - .findAllWhereLicenseSessionId(sessionId); - return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(licenseMultipleChoiceQuestions); - } + /** + * 관리자 조회시 허용 여부와 관련 없이 모든 문제를 가져온다. + * 문제지도 섞지 않는다. + * 허용 여부 순대로 섞는다 + */ + @Override + public Map> getClassifiedLicenseMultipleChoiceQuestion( + Long sessionId) { + List licenseMultipleChoiceQuestions = licenseMultipleChoiceQuestionDslRepository + .findAllWhereLicenseSessionId(sessionId); + return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(licenseMultipleChoiceQuestions); + } } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/major/AdminMajorQuestionClassifiedGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/major/AdminMajorQuestionClassifiedGetService.java index 55fc058..22c6bde 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/major/AdminMajorQuestionClassifiedGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/major/AdminMajorQuestionClassifiedGetService.java @@ -8,7 +8,7 @@ import java.util.Map; public interface AdminMajorQuestionClassifiedGetService { - Map> getClassifiedAllMajorMultipleChoiceQuestions(); + Map> getClassifiedAllMajorMultipleChoiceQuestions(); - Map> getClassifiedAllMajorDescriptiveQuestions(); + Map> getClassifiedAllMajorDescriptiveQuestions(); } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/major/MajorQuestionClassifiedGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/major/MajorQuestionClassifiedGetService.java index c3cbbbb..b693606 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/major/MajorQuestionClassifiedGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/major/MajorQuestionClassifiedGetService.java @@ -11,16 +11,16 @@ @Service public interface MajorQuestionClassifiedGetService { - /** - * 분류별로 나누어 문제를 반환 - */ - Map> getApprovedClassifiedMajorMultipleChoiceQuestions( - RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto); + /** + * 분류별로 나누어 문제를 반환 + */ + Map> getApprovedClassifiedMajorMultipleChoiceQuestions( + RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto); - Map> getApprovedClassifiedDescriptiveQuestions( - RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto - ); + Map> getApprovedClassifiedDescriptiveQuestions( + RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto + ); } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionClassifiedGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionClassifiedGetService.java index 9fb7237..1ad51cc 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionClassifiedGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionClassifiedGetService.java @@ -20,27 +20,27 @@ @RequiredArgsConstructor @Transactional public class BasicAdminMajorQuestionClassifiedGetService implements AdminMajorQuestionClassifiedGetService { - private final QuestionClassifyByCategoryService questionClassifyByCategoryService; - private final MajorDescriptiveDslRepository majorDescriptiveQuestionChooseRepository; - private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository; + private final QuestionClassifyByCategoryService questionClassifyByCategoryService; + private final MajorDescriptiveDslRepository majorDescriptiveQuestionChooseRepository; + private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository; - /** - * 관리자가 조회시 Approve됐는지 기준으로 정렬되며(false인 것부터), - * 이후엔 객관식 -> 주관식으로 정렬된다. - * - * @return - */ - @Override - public Map> getClassifiedAllMajorMultipleChoiceQuestions() { - List majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository - .findAllOrderByIfApprovedAsc(); - return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions); - } + /** + * 관리자가 조회시 Approve됐는지 기준으로 정렬되며(false인 것부터), + * 이후엔 객관식 -> 주관식으로 정렬된다. + * + * @return + */ + @Override + public Map> getClassifiedAllMajorMultipleChoiceQuestions() { + List majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository + .findAllOrderByIfApprovedAsc(); + return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions); + } - @Override - public Map> getClassifiedAllMajorDescriptiveQuestions() { - List majorDescriptiveQuestions = - majorDescriptiveQuestionChooseRepository.findAllOrderByIfApprovedAsc(); - return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions); - } + @Override + public Map> getClassifiedAllMajorDescriptiveQuestions() { + List majorDescriptiveQuestions = + majorDescriptiveQuestionChooseRepository.findAllOrderByIfApprovedAsc(); + return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions); + } } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionMakeService.java b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionMakeService.java index 4c8eab5..ef2f13f 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionMakeService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionMakeService.java @@ -22,74 +22,74 @@ @Transactional public class BasicAdminMajorQuestionMakeService implements AdminMajorQuestionMakeService { - private final QuestionRepository questionRepository; - private final MajorMultipleChoiceQuestionRepository majorMultipleChoiceQuestionRepository; - private final QuestionChoiceService questionChoiceService; - private final DuplicateQuestionDetector duplicateQuestionDetector; + private final QuestionRepository questionRepository; + private final MajorMultipleChoiceQuestionRepository majorMultipleChoiceQuestionRepository; + private final QuestionChoiceService questionChoiceService; + private final DuplicateQuestionDetector duplicateQuestionDetector; - /** - * 리스트로 생성 - */ - @Override - public List makeMultipleChoiceQuestions( - List requestDtos) { - // 중복되지 않은 질문을 필터링하여 저장 - return requestDtos.stream() - .filter(this::isNotDuplicateQuestion) - .map(this::saveMajorMultipleChoiceQuestion) - .collect(Collectors.toList()); - } + /** + * 리스트로 생성 + */ + @Override + public List makeMultipleChoiceQuestions( + List requestDtos) { + // 중복되지 않은 질문을 필터링하여 저장 + return requestDtos.stream() + .filter(this::isNotDuplicateQuestion) + .map(this::saveMajorMultipleChoiceQuestion) + .collect(Collectors.toList()); + } - /** - * 단일 생성 - */ - @Override - public MajorMultipleChoiceQuestion makeMultipleChoiceQuestion( - RequestMakeMultipleChoiceQuestionDto requestDto) throws DuplicateQuestionContentException { - if (!isNotDuplicateQuestion(requestDto)) { - throw new DuplicateQuestionContentException(); - } - return saveMajorMultipleChoiceQuestion(requestDto); - } + /** + * 단일 생성 + */ + @Override + public MajorMultipleChoiceQuestion makeMultipleChoiceQuestion( + RequestMakeMultipleChoiceQuestionDto requestDto) throws DuplicateQuestionContentException { + if (!isNotDuplicateQuestion(requestDto)) { + throw new DuplicateQuestionContentException(); + } + return saveMajorMultipleChoiceQuestion(requestDto); + } - @Override - public List makeDescriptiveQuestions( - List requestNormalQuestionDto) { + @Override + public List makeDescriptiveQuestions( + List requestNormalQuestionDto) { - return requestNormalQuestionDto.stream() - .map(this::saveMajorDescriptiveQuestion) - .collect(Collectors.toList()); - } + return requestNormalQuestionDto.stream() + .map(this::saveMajorDescriptiveQuestion) + .collect(Collectors.toList()); + } - /** - * 중복되지 않은 질문인지 확인하는 메서드 - * 매번 DB에서 새롭게 조회 후 검증한다.(DTO 자체의 중복된 데이터) - */ - private boolean isNotDuplicateQuestion(RequestMakeMultipleChoiceQuestionDto requestDto) { - return majorMultipleChoiceQuestionRepository.findAll().stream() - .noneMatch(existingQuestion -> duplicateQuestionDetector.isQuestionDuplicate( - existingQuestion.getContent(), requestDto.getContent())); - } + /** + * 중복되지 않은 질문인지 확인하는 메서드 + * 매번 DB에서 새롭게 조회 후 검증한다.(DTO 자체의 중복된 데이터) + */ + private boolean isNotDuplicateQuestion(RequestMakeMultipleChoiceQuestionDto requestDto) { + return majorMultipleChoiceQuestionRepository.findAll().stream() + .noneMatch(existingQuestion -> duplicateQuestionDetector.isQuestionDuplicate( + existingQuestion.getContent(), requestDto.getContent())); + } - /** - * 새로운 질문을 저장하고 선택지를 저장하는 메서드 - */ - private MajorMultipleChoiceQuestion saveMajorMultipleChoiceQuestion( - RequestMakeMultipleChoiceQuestionDto requestDto) { - MajorMultipleChoiceQuestion question = MajorMultipleChoiceQuestion.makeWithDto(requestDto); - questionRepository.save(question); - questionChoiceService.saveWith(requestDto, question); - return question; - } + /** + * 새로운 질문을 저장하고 선택지를 저장하는 메서드 + */ + private MajorMultipleChoiceQuestion saveMajorMultipleChoiceQuestion( + RequestMakeMultipleChoiceQuestionDto requestDto) { + MajorMultipleChoiceQuestion question = MajorMultipleChoiceQuestion.makeWithDto(requestDto); + questionRepository.save(question); + questionChoiceService.saveWith(requestDto, question); + return question; + } - private MajorDescriptiveQuestion saveMajorDescriptiveQuestion( - RequestMakeMajorDescriptiveQuestionDto requestDto - ) { - MajorDescriptiveQuestion question = MajorDescriptiveQuestion.makeWithDto( - requestDto - ); - questionRepository.save(question); - return question; - } + private MajorDescriptiveQuestion saveMajorDescriptiveQuestion( + RequestMakeMajorDescriptiveQuestionDto requestDto + ) { + MajorDescriptiveQuestion question = MajorDescriptiveQuestion.makeWithDto( + requestDto + ); + questionRepository.save(question); + return question; + } } diff --git a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/UserMajorQuestionClassifiedGetService.java b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/UserMajorQuestionClassifiedGetService.java index bba3ae7..85cebb0 100644 --- a/application/src/main/java/com/comssa/api/question/service/rest/major/implement/UserMajorQuestionClassifiedGetService.java +++ b/application/src/main/java/com/comssa/api/question/service/rest/major/implement/UserMajorQuestionClassifiedGetService.java @@ -20,41 +20,41 @@ @Service @RequiredArgsConstructor public class UserMajorQuestionClassifiedGetService implements MajorQuestionClassifiedGetService { - private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository; - private final QuestionClassifyByCategoryService questionClassifyByCategoryService; - private final MajorDescriptiveDslRepository majorDescriptiveQuestionDslRepository; + private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository; + private final QuestionClassifyByCategoryService questionClassifyByCategoryService; + private final MajorDescriptiveDslRepository majorDescriptiveQuestionDslRepository; - /** - * 분야, 난이도 파라미터로 문제를 조회하는 경우 - 객관식. - * 문제 선택지들을 섞어준다. - */ - @Override - public Map> getApprovedClassifiedMajorMultipleChoiceQuestions( - RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto) { - List majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository - .findAllCategoriesAndLevelsAndIfApproved( - requestGetQuestionByCategoryAndLevelDto.getQuestionCategories(), - requestGetQuestionByCategoryAndLevelDto.getQuestionLevels(), - true); - for (MajorMultipleChoiceQuestion question : majorMultipleChoiceQuestions) { - Collections.shuffle(question.getQuestionChoices()); - } - return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions); - } + /** + * 분야, 난이도 파라미터로 문제를 조회하는 경우 - 객관식. + * 문제 선택지들을 섞어준다. + */ + @Override + public Map> getApprovedClassifiedMajorMultipleChoiceQuestions( + RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto) { + List majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository + .findAllCategoriesAndLevelsAndIfApproved( + requestGetQuestionByCategoryAndLevelDto.getQuestionCategories(), + requestGetQuestionByCategoryAndLevelDto.getQuestionLevels(), + true); + for (MajorMultipleChoiceQuestion question : majorMultipleChoiceQuestions) { + Collections.shuffle(question.getQuestionChoices()); + } + return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions); + } - /** - * 분야, 난이도 파라미터로 문제를 조회하는 경우 - 서술형 - */ - @Override - public Map> getApprovedClassifiedDescriptiveQuestions( - RequestGetQuestionByCategoryAndLevelDto dto) { - List majorDescriptiveQuestions = majorDescriptiveQuestionDslRepository - .findAllCategoriesAndLevelsAndIfApproved( - dto.getQuestionCategories(), - dto.getQuestionLevels(), - true - ); - return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions); - } + /** + * 분야, 난이도 파라미터로 문제를 조회하는 경우 - 서술형 + */ + @Override + public Map> getApprovedClassifiedDescriptiveQuestions( + RequestGetQuestionByCategoryAndLevelDto dto) { + List majorDescriptiveQuestions = majorDescriptiveQuestionDslRepository + .findAllCategoriesAndLevelsAndIfApproved( + dto.getQuestionCategories(), + dto.getQuestionLevels(), + true + ); + return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions); + } } diff --git a/application/src/main/java/com/comssa/api/question/service/view/HtmlTagService.java b/application/src/main/java/com/comssa/api/question/service/view/HtmlTagService.java index abd5889..17d2c5a 100644 --- a/application/src/main/java/com/comssa/api/question/service/view/HtmlTagService.java +++ b/application/src/main/java/com/comssa/api/question/service/view/HtmlTagService.java @@ -76,6 +76,7 @@ public void forLicenseQuestion(LicenseSession licenseSession, Model model) { public void forMajor(Set questionCategories, boolean isMultipleChoice, Model model) { if (isMultipleChoice) { addTagToModel(forMajorMultiple(questionCategories), model); + return; } addTagToModel(forMajorDescriptive(questionCategories), model); } diff --git a/application/src/main/resources/static/css/question/descriptive-style.css b/application/src/main/resources/static/css/question/descriptive-style.css index 8ba98e3..80a7c64 100644 --- a/application/src/main/resources/static/css/question/descriptive-style.css +++ b/application/src/main/resources/static/css/question/descriptive-style.css @@ -43,7 +43,7 @@ border-radius: 5px; font-size: 1rem; line-height: 1.6; - color: #999; + /*color: #999;*/ } /* 버튼 그룹 스타일 */ diff --git a/application/src/main/resources/static/js/solveDescriptiveQuestion.js b/application/src/main/resources/static/js/solveDescriptiveQuestion.js index 86fc6ff..8d0b3ba 100644 --- a/application/src/main/resources/static/js/solveDescriptiveQuestion.js +++ b/application/src/main/resources/static/js/solveDescriptiveQuestion.js @@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => { eventSource.onmessage = (event) => { // JSON 문자열을 JavaScript 객체로 파싱 const parsedData = JSON.parse(event.data); - + const deltaContent = parsedData.firstChoiceDelta; // 출력 및 포맷팅 diff --git a/application/src/main/resources/templates/index.html b/application/src/main/resources/templates/index.html index baabd3b..9c2eda5 100644 --- a/application/src/main/resources/templates/index.html +++ b/application/src/main/resources/templates/index.html @@ -115,10 +115,10 @@

난이도

diff --git a/core/src/main/kotlin/com/comssa/core/question/service/common/DescriptiveQuestionService.kt b/core/src/main/kotlin/com/comssa/core/question/service/common/DescriptiveQuestionService.kt index 9fe76f8..3e9084c 100644 --- a/core/src/main/kotlin/com/comssa/core/question/service/common/DescriptiveQuestionService.kt +++ b/core/src/main/kotlin/com/comssa/core/question/service/common/DescriptiveQuestionService.kt @@ -43,6 +43,8 @@ class DescriptiveQuestionService( "2. 사용자가 틀린 내용을 말한다면 틀렸다고 말씀해주세요." + "채점 기준에 사용자의 답변이 부합하지 않더라도, 채점 기준이 무조건 적인 정답이 되어선 안됩니다." + "그러니 지적할 때, ~이렇게 대답하셔야합니다. 보단 ~ 이런 내용을 보충하시면 더 좋을 거같습니다. 이런 식으로 지적해주세요." + + "다만 당신의 답변도 Too Much Information을 담아선 안 됩니다. 예를 들어 JVM의 컴파일 과정에 대해 물어보았는데, " + + "당신의 답변에 JIT 컴파일러 내용이 들어가있으면 좋지 않습니다. 관련성은 있지만, 물어본 질문에 대해서만 답변을 해주세요." + "문제 채점 기준은 다음과 같습니다. 주어진 채점 기준이 없다면 당신이 임의로 판단해서 채점해주세요. " + "" }