Skip to content

Commit 777a6df

Browse files
committed
style: 코딩 컨벤션 적용
1 parent 675cca9 commit 777a6df

13 files changed

+151
-148
lines changed

application/src/main/java/com/comssa/api/question/service/rest/common/QuestionClassifyByCategoryService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
@Service
1212
public interface QuestionClassifyByCategoryService {
13-
Map<QuestionCategory, List<Question>> classifyQuestionByCategoryOrdered(List<? extends Question> questions);
13+
Map<QuestionCategory, List<Question>> classifyQuestionByCategoryOrdered(List<? extends Question> questions);
1414
}
1515

application/src/main/java/com/comssa/api/question/service/rest/license/LicenseQuestionGetService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
@Service
1212
public interface LicenseQuestionGetService {
13-
Map<QuestionCategory, List<Question>> getClassifiedLicenseMultipleChoiceQuestion(
14-
Long sessionId);
13+
Map<QuestionCategory, List<Question>> getClassifiedLicenseMultipleChoiceQuestion(
14+
Long sessionId);
1515
}

application/src/main/java/com/comssa/api/question/service/rest/license/implement/AdminLicenseQuestionGetService.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
@RequiredArgsConstructor
2020
public class AdminLicenseQuestionGetService implements LicenseQuestionGetService {
2121

22-
private final LicenseMultipleChoiceQuestionDslRepository licenseMultipleChoiceQuestionDslRepository;
23-
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
22+
private final LicenseMultipleChoiceQuestionDslRepository licenseMultipleChoiceQuestionDslRepository;
23+
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
2424

25-
/**
26-
* 관리자 조회시 허용 여부와 관련 없이 모든 문제를 가져온다.
27-
* 문제지도 섞지 않는다.
28-
* 허용 여부 순대로 섞는다
29-
*/
30-
@Override
31-
public Map<QuestionCategory, List<Question>> getClassifiedLicenseMultipleChoiceQuestion(
32-
Long sessionId) {
33-
List<LicenseMultipleChoiceQuestion> licenseMultipleChoiceQuestions = licenseMultipleChoiceQuestionDslRepository
34-
.findAllWhereLicenseSessionId(sessionId);
35-
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(licenseMultipleChoiceQuestions);
36-
}
25+
/**
26+
* 관리자 조회시 허용 여부와 관련 없이 모든 문제를 가져온다.
27+
* 문제지도 섞지 않는다.
28+
* 허용 여부 순대로 섞는다
29+
*/
30+
@Override
31+
public Map<QuestionCategory, List<Question>> getClassifiedLicenseMultipleChoiceQuestion(
32+
Long sessionId) {
33+
List<LicenseMultipleChoiceQuestion> licenseMultipleChoiceQuestions = licenseMultipleChoiceQuestionDslRepository
34+
.findAllWhereLicenseSessionId(sessionId);
35+
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(licenseMultipleChoiceQuestions);
36+
}
3737
}

application/src/main/java/com/comssa/api/question/service/rest/major/AdminMajorQuestionClassifiedGetService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.Map;
99

1010
public interface AdminMajorQuestionClassifiedGetService {
11-
Map<QuestionCategory, List<Question>> getClassifiedAllMajorMultipleChoiceQuestions();
11+
Map<QuestionCategory, List<Question>> getClassifiedAllMajorMultipleChoiceQuestions();
1212

13-
Map<QuestionCategory, List<Question>> getClassifiedAllMajorDescriptiveQuestions();
13+
Map<QuestionCategory, List<Question>> getClassifiedAllMajorDescriptiveQuestions();
1414
}

application/src/main/java/com/comssa/api/question/service/rest/major/MajorQuestionClassifiedGetService.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
@Service
1313
public interface MajorQuestionClassifiedGetService<T extends Question> {
14-
/**
15-
* 분류별로 나누어 문제를 반환
16-
*/
17-
Map<QuestionCategory, List<T>> getApprovedClassifiedMajorMultipleChoiceQuestions(
18-
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto);
14+
/**
15+
* 분류별로 나누어 문제를 반환
16+
*/
17+
Map<QuestionCategory, List<T>> getApprovedClassifiedMajorMultipleChoiceQuestions(
18+
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto);
1919

2020

21-
Map<QuestionCategory, List<T>> getApprovedClassifiedDescriptiveQuestions(
22-
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto
23-
);
21+
Map<QuestionCategory, List<T>> getApprovedClassifiedDescriptiveQuestions(
22+
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto
23+
);
2424

2525
}
2626

application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionClassifiedGetService.java

+21-21
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@
2020
@RequiredArgsConstructor
2121
@Transactional
2222
public class BasicAdminMajorQuestionClassifiedGetService implements AdminMajorQuestionClassifiedGetService {
23-
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
24-
private final MajorDescriptiveDslRepository majorDescriptiveQuestionChooseRepository;
25-
private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository;
23+
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
24+
private final MajorDescriptiveDslRepository majorDescriptiveQuestionChooseRepository;
25+
private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository;
2626

27-
/**
28-
* 관리자가 조회시 Approve됐는지 기준으로 정렬되며(false인 것부터),
29-
* 이후엔 객관식 -> 주관식으로 정렬된다.
30-
*
31-
* @return
32-
*/
33-
@Override
34-
public Map<QuestionCategory, List<Question>> getClassifiedAllMajorMultipleChoiceQuestions() {
35-
List<MajorMultipleChoiceQuestion> majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository
36-
.findAllOrderByIfApprovedAsc();
37-
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions);
38-
}
27+
/**
28+
* 관리자가 조회시 Approve됐는지 기준으로 정렬되며(false인 것부터),
29+
* 이후엔 객관식 -> 주관식으로 정렬된다.
30+
*
31+
* @return
32+
*/
33+
@Override
34+
public Map<QuestionCategory, List<Question>> getClassifiedAllMajorMultipleChoiceQuestions() {
35+
List<MajorMultipleChoiceQuestion> majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository
36+
.findAllOrderByIfApprovedAsc();
37+
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions);
38+
}
3939

40-
@Override
41-
public Map<QuestionCategory, List<Question>> getClassifiedAllMajorDescriptiveQuestions() {
42-
List<MajorDescriptiveQuestion> majorDescriptiveQuestions =
43-
majorDescriptiveQuestionChooseRepository.findAllOrderByIfApprovedAsc();
44-
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions);
45-
}
40+
@Override
41+
public Map<QuestionCategory, List<Question>> getClassifiedAllMajorDescriptiveQuestions() {
42+
List<MajorDescriptiveQuestion> majorDescriptiveQuestions =
43+
majorDescriptiveQuestionChooseRepository.findAllOrderByIfApprovedAsc();
44+
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions);
45+
}
4646
}

application/src/main/java/com/comssa/api/question/service/rest/major/implement/BasicAdminMajorQuestionMakeService.java

+62-62
Original file line numberDiff line numberDiff line change
@@ -22,74 +22,74 @@
2222
@Transactional
2323
public class BasicAdminMajorQuestionMakeService implements AdminMajorQuestionMakeService {
2424

25-
private final QuestionRepository questionRepository;
26-
private final MajorMultipleChoiceQuestionRepository majorMultipleChoiceQuestionRepository;
27-
private final QuestionChoiceService questionChoiceService;
28-
private final DuplicateQuestionDetector duplicateQuestionDetector;
25+
private final QuestionRepository questionRepository;
26+
private final MajorMultipleChoiceQuestionRepository majorMultipleChoiceQuestionRepository;
27+
private final QuestionChoiceService questionChoiceService;
28+
private final DuplicateQuestionDetector duplicateQuestionDetector;
2929

30-
/**
31-
* 리스트로 생성
32-
*/
33-
@Override
34-
public List<MajorMultipleChoiceQuestion> makeMultipleChoiceQuestions(
35-
List<RequestMakeMultipleChoiceQuestionDto> requestDtos) {
36-
// 중복되지 않은 질문을 필터링하여 저장
37-
return requestDtos.stream()
38-
.filter(this::isNotDuplicateQuestion)
39-
.map(this::saveMajorMultipleChoiceQuestion)
40-
.collect(Collectors.toList());
41-
}
30+
/**
31+
* 리스트로 생성
32+
*/
33+
@Override
34+
public List<MajorMultipleChoiceQuestion> makeMultipleChoiceQuestions(
35+
List<RequestMakeMultipleChoiceQuestionDto> requestDtos) {
36+
// 중복되지 않은 질문을 필터링하여 저장
37+
return requestDtos.stream()
38+
.filter(this::isNotDuplicateQuestion)
39+
.map(this::saveMajorMultipleChoiceQuestion)
40+
.collect(Collectors.toList());
41+
}
4242

43-
/**
44-
* 단일 생성
45-
*/
46-
@Override
47-
public MajorMultipleChoiceQuestion makeMultipleChoiceQuestion(
48-
RequestMakeMultipleChoiceQuestionDto requestDto) throws DuplicateQuestionContentException {
49-
if (!isNotDuplicateQuestion(requestDto)) {
50-
throw new DuplicateQuestionContentException();
51-
}
52-
return saveMajorMultipleChoiceQuestion(requestDto);
53-
}
43+
/**
44+
* 단일 생성
45+
*/
46+
@Override
47+
public MajorMultipleChoiceQuestion makeMultipleChoiceQuestion(
48+
RequestMakeMultipleChoiceQuestionDto requestDto) throws DuplicateQuestionContentException {
49+
if (!isNotDuplicateQuestion(requestDto)) {
50+
throw new DuplicateQuestionContentException();
51+
}
52+
return saveMajorMultipleChoiceQuestion(requestDto);
53+
}
5454

55-
@Override
56-
public List<MajorDescriptiveQuestion> makeDescriptiveQuestions(
57-
List<RequestMakeMajorDescriptiveQuestionDto> requestNormalQuestionDto) {
55+
@Override
56+
public List<MajorDescriptiveQuestion> makeDescriptiveQuestions(
57+
List<RequestMakeMajorDescriptiveQuestionDto> requestNormalQuestionDto) {
5858

59-
return requestNormalQuestionDto.stream()
60-
.map(this::saveMajorDescriptiveQuestion)
61-
.collect(Collectors.toList());
62-
}
59+
return requestNormalQuestionDto.stream()
60+
.map(this::saveMajorDescriptiveQuestion)
61+
.collect(Collectors.toList());
62+
}
6363

64-
/**
65-
* 중복되지 않은 질문인지 확인하는 메서드
66-
* 매번 DB에서 새롭게 조회 후 검증한다.(DTO 자체의 중복된 데이터)
67-
*/
68-
private boolean isNotDuplicateQuestion(RequestMakeMultipleChoiceQuestionDto requestDto) {
69-
return majorMultipleChoiceQuestionRepository.findAll().stream()
70-
.noneMatch(existingQuestion -> duplicateQuestionDetector.isQuestionDuplicate(
71-
existingQuestion.getContent(), requestDto.getContent()));
72-
}
64+
/**
65+
* 중복되지 않은 질문인지 확인하는 메서드
66+
* 매번 DB에서 새롭게 조회 후 검증한다.(DTO 자체의 중복된 데이터)
67+
*/
68+
private boolean isNotDuplicateQuestion(RequestMakeMultipleChoiceQuestionDto requestDto) {
69+
return majorMultipleChoiceQuestionRepository.findAll().stream()
70+
.noneMatch(existingQuestion -> duplicateQuestionDetector.isQuestionDuplicate(
71+
existingQuestion.getContent(), requestDto.getContent()));
72+
}
7373

74-
/**
75-
* 새로운 질문을 저장하고 선택지를 저장하는 메서드
76-
*/
77-
private MajorMultipleChoiceQuestion saveMajorMultipleChoiceQuestion(
78-
RequestMakeMultipleChoiceQuestionDto requestDto) {
79-
MajorMultipleChoiceQuestion question = MajorMultipleChoiceQuestion.makeWithDto(requestDto);
80-
questionRepository.save(question);
81-
questionChoiceService.saveWith(requestDto, question);
82-
return question;
83-
}
74+
/**
75+
* 새로운 질문을 저장하고 선택지를 저장하는 메서드
76+
*/
77+
private MajorMultipleChoiceQuestion saveMajorMultipleChoiceQuestion(
78+
RequestMakeMultipleChoiceQuestionDto requestDto) {
79+
MajorMultipleChoiceQuestion question = MajorMultipleChoiceQuestion.makeWithDto(requestDto);
80+
questionRepository.save(question);
81+
questionChoiceService.saveWith(requestDto, question);
82+
return question;
83+
}
8484

85-
private MajorDescriptiveQuestion saveMajorDescriptiveQuestion(
86-
RequestMakeMajorDescriptiveQuestionDto requestDto
87-
) {
88-
MajorDescriptiveQuestion question = MajorDescriptiveQuestion.makeWithDto(
89-
requestDto
90-
);
91-
questionRepository.save(question);
92-
return question;
93-
}
85+
private MajorDescriptiveQuestion saveMajorDescriptiveQuestion(
86+
RequestMakeMajorDescriptiveQuestionDto requestDto
87+
) {
88+
MajorDescriptiveQuestion question = MajorDescriptiveQuestion.makeWithDto(
89+
requestDto
90+
);
91+
questionRepository.save(question);
92+
return question;
93+
}
9494
}
9595

application/src/main/java/com/comssa/api/question/service/rest/major/implement/UserMajorQuestionClassifiedGetService.java

+34-34
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,41 @@
2020
@Service
2121
@RequiredArgsConstructor
2222
public class UserMajorQuestionClassifiedGetService implements MajorQuestionClassifiedGetService<Question> {
23-
private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository;
24-
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
25-
private final MajorDescriptiveDslRepository majorDescriptiveQuestionDslRepository;
23+
private final MajorMultipleChoiceQuestionDslRepository majorMultipleChoiceQuestionDslRepository;
24+
private final QuestionClassifyByCategoryService questionClassifyByCategoryService;
25+
private final MajorDescriptiveDslRepository majorDescriptiveQuestionDslRepository;
2626

27-
/**
28-
* 분야, 난이도 파라미터로 문제를 조회하는 경우 - 객관식.
29-
* 문제 선택지들을 섞어준다.
30-
*/
31-
@Override
32-
public Map<QuestionCategory, List<Question>> getApprovedClassifiedMajorMultipleChoiceQuestions(
33-
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto) {
34-
List<MajorMultipleChoiceQuestion> majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository
35-
.findAllCategoriesAndLevelsAndIfApproved(
36-
requestGetQuestionByCategoryAndLevelDto.getQuestionCategories(),
37-
requestGetQuestionByCategoryAndLevelDto.getQuestionLevels(),
38-
true);
39-
for (MajorMultipleChoiceQuestion question : majorMultipleChoiceQuestions) {
40-
Collections.shuffle(question.getQuestionChoices());
41-
}
42-
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions);
43-
}
27+
/**
28+
* 분야, 난이도 파라미터로 문제를 조회하는 경우 - 객관식.
29+
* 문제 선택지들을 섞어준다.
30+
*/
31+
@Override
32+
public Map<QuestionCategory, List<Question>> getApprovedClassifiedMajorMultipleChoiceQuestions(
33+
RequestGetQuestionByCategoryAndLevelDto requestGetQuestionByCategoryAndLevelDto) {
34+
List<MajorMultipleChoiceQuestion> majorMultipleChoiceQuestions = majorMultipleChoiceQuestionDslRepository
35+
.findAllCategoriesAndLevelsAndIfApproved(
36+
requestGetQuestionByCategoryAndLevelDto.getQuestionCategories(),
37+
requestGetQuestionByCategoryAndLevelDto.getQuestionLevels(),
38+
true);
39+
for (MajorMultipleChoiceQuestion question : majorMultipleChoiceQuestions) {
40+
Collections.shuffle(question.getQuestionChoices());
41+
}
42+
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorMultipleChoiceQuestions);
43+
}
4444

4545

46-
/**
47-
* 분야, 난이도 파라미터로 문제를 조회하는 경우 - 서술형
48-
*/
49-
@Override
50-
public Map<QuestionCategory, List<Question>> getApprovedClassifiedDescriptiveQuestions(
51-
RequestGetQuestionByCategoryAndLevelDto dto) {
52-
List<MajorDescriptiveQuestion> majorDescriptiveQuestions = majorDescriptiveQuestionDslRepository
53-
.findAllCategoriesAndLevelsAndIfApproved(
54-
dto.getQuestionCategories(),
55-
dto.getQuestionLevels(),
56-
true
57-
);
58-
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions);
59-
}
46+
/**
47+
* 분야, 난이도 파라미터로 문제를 조회하는 경우 - 서술형
48+
*/
49+
@Override
50+
public Map<QuestionCategory, List<Question>> getApprovedClassifiedDescriptiveQuestions(
51+
RequestGetQuestionByCategoryAndLevelDto dto) {
52+
List<MajorDescriptiveQuestion> majorDescriptiveQuestions = majorDescriptiveQuestionDslRepository
53+
.findAllCategoriesAndLevelsAndIfApproved(
54+
dto.getQuestionCategories(),
55+
dto.getQuestionLevels(),
56+
true
57+
);
58+
return questionClassifyByCategoryService.classifyQuestionByCategoryOrdered(majorDescriptiveQuestions);
59+
}
6060
}

application/src/main/java/com/comssa/api/question/service/view/HtmlTagService.java

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void forLicenseQuestion(LicenseSession licenseSession, Model model) {
7676
public void forMajor(Set<QuestionCategory> questionCategories, boolean isMultipleChoice, Model model) {
7777
if (isMultipleChoice) {
7878
addTagToModel(forMajorMultiple(questionCategories), model);
79+
return;
7980
}
8081
addTagToModel(forMajorDescriptive(questionCategories), model);
8182
}

application/src/main/resources/static/css/question/descriptive-style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
border-radius: 5px;
4444
font-size: 1rem;
4545
line-height: 1.6;
46-
color: #999;
46+
/*color: #999;*/
4747
}
4848

4949
/* 버튼 그룹 스타일 */

application/src/main/resources/static/js/solveDescriptiveQuestion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => {
2626
eventSource.onmessage = (event) => {
2727
// JSON 문자열을 JavaScript 객체로 파싱
2828
const parsedData = JSON.parse(event.data);
29-
29+
3030
const deltaContent = parsedData.firstChoiceDelta;
3131

3232
// 출력 및 포맷팅

application/src/main/resources/templates/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ <h2 class="standard">난이도</h2>
115115
</div>
116116
<div class="start-button-container">
117117
<button class="start-left-box" onclick="makeMultipleChoice(true)" type="submit">
118-
<span class="start-button-text">객관식</span>
118+
<span class="start-button-text">객관식 문제 풀기</span>
119119
</button>
120120
<button class="start-right-box" onclick="makeMultipleChoice(false)" type="submit">
121-
<span class="start-button-text">면접식</span>
121+
<span class="start-button-text">기술 면접 연습하기</span>
122122
</button>
123123
</div>
124124

core/src/main/kotlin/com/comssa/core/question/service/common/DescriptiveQuestionService.kt

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class DescriptiveQuestionService(
4343
"2. 사용자가 틀린 내용을 말한다면 틀렸다고 말씀해주세요." +
4444
"채점 기준에 사용자의 답변이 부합하지 않더라도, 채점 기준이 무조건 적인 정답이 되어선 안됩니다." +
4545
"그러니 지적할 때, ~이렇게 대답하셔야합니다. 보단 ~ 이런 내용을 보충하시면 더 좋을 거같습니다. 이런 식으로 지적해주세요." +
46+
"다만 당신의 답변도 Too Much Information을 담아선 안 됩니다. 예를 들어 JVM의 컴파일 과정에 대해 물어보았는데, " +
47+
"당신의 답변에 JIT 컴파일러 내용이 들어가있으면 좋지 않습니다. 관련성은 있지만, 물어본 질문에 대해서만 답변을 해주세요." +
4648
"문제 채점 기준은 다음과 같습니다. 주어진 채점 기준이 없다면 당신이 임의로 판단해서 채점해주세요. " +
4749
""
4850
}

0 commit comments

Comments
 (0)