Skip to content

Commit

Permalink
Merge pull request #120 from mash-up-kr/xonmin/update-get-questionSheet
Browse files Browse the repository at this point in the history
update : questionSheet 조회시 order sort
  • Loading branch information
xonmin authored Aug 22, 2024
2 parents d4d3617 + fb16e68 commit f59c0fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ data class QuestionSheetResponse(
val resolverId: MemberId,
@Schema(description = "질문 고유 id")
val questionId: QuestionId,
@Schema(description = "질문지 묶음 중 해당 질문지의 순서")
@Schema(description = "질문지 묶음 중 해당 질문지의 순서. 1부터 시작(1based) ~ max : QuestionSheetsGetResponse.sheetTotalCount")
val questionOrder: Int,
@Schema(description = "질문 내용")
val questionContent: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ class DefaultQuestionUseCase(

val question = questionService.getQuestionById(qSheet.questionId) ?: throw DojoException.of(DojoExceptionType.QUESTION_NOT_EXIST)
val imageUrl = imageService.load(question.emojiImageId)?.url ?: throw DojoException.of(DojoExceptionType.NOT_EXIST, "image id ${question.emojiImageId} not exist")
val questionOrder = questionIds.indexOf(qSheet.questionId)
val questionOrder = questionIds.indexOf(qSheet.questionId) + 1 // 순서는 1based

qSheet.toQuestionSheetResult(questionOrder, question.content, question.category, imageUrl, candidateResults)
}
.sortedBy { it.questionOrder }

return QuestionUseCase.GetQuestionSheetsResult(
resolverId = memberId,
Expand Down

0 comments on commit f59c0fe

Please sign in to comment.