From fb16e6895ad617d990d1ce22324e91d6ed34bff0 Mon Sep 17 00:00:00 2001 From: xonmin Date: Thu, 22 Aug 2024 18:59:29 +0900 Subject: [PATCH] =?UTF-8?q?update=20:=20questionSheet=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EC=8B=9C=20order=20sort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt | 2 +- .../src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt b/api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt index dcad696c..c47dd4a6 100644 --- a/api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt +++ b/api/src/main/kotlin/com/mashup/dojo/dto/QuestionDto.kt @@ -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, diff --git a/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt b/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt index 7ae83bb8..3affad3e 100644 --- a/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt +++ b/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt @@ -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,