Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ internal data class PreQuestionAnswerDetailResponse(
internal data class PreQuestionAnswerItemResponse(
val preQuestionId: Long,
val question: String,
val description: String?,
val description: String,
val isRequired: Boolean,
val answer: String?,
val answer: String,
val createdAt: String?,
val modifiedAt: String?,
)

internal fun PreQuestionAnswerItemResponse.toDomain() = PreQuestionAnswer(
preQuestionId = preQuestionId,
question = question,
description = description.orEmpty(),
description = description,
isRequired = isRequired,
answer = answer.orEmpty(),
answer = answer,
)

internal fun List<PreQuestionAnswerItemResponse>.toDomains() = map { it.toDomain() }
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class PreQuestionEditViewModel @Inject constructor(
private fun submitAnswers() {
val state = uiState.value
val answerRequests = state.answers
.filter { (_, answer) -> answer.isNotBlank() }
.map { (questionId, answer) ->
PreQuestionAnswerRequest(
preQuestionId = questionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,13 @@ class TicketingViewModel @Inject constructor(
if (state.preQuestions.isEmpty()) return

val answers = state.preQuestionAnswers
.filter { (_, answer) -> answer.isNotBlank() }
.map { (questionId, answer) ->
PreQuestionAnswerRequest(
preQuestionId = questionId,
answer = answer,
)
}

if (answers.isEmpty()) return

val request = SubmitPreQuestionAnswersRequest(
reservationId = reservationId,
answers = answers,
Expand Down
Loading