Skip to content

Commit

Permalink
fix: quiz랑 exam 로직이 같이 적용되는 부분 수정 (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvergreenTree97 authored May 28, 2023
1 parent 408f6f6 commit 4079d64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ internal fun StartQuizInputScreen(modifier: Modifier, viewModel: StartExamViewMo
val state =
viewModel.container.stateFlow.collectAsStateWithLifecycle().value as StartExamState.Input

val certifyingStatement: String = remember(state.certifyingStatement) {
state.certifyingStatement
}
val certifyingStatementText: String = remember(state.certifyingStatementInputText) {
state.certifyingStatementInputText
}
Expand Down Expand Up @@ -94,7 +91,7 @@ internal fun StartQuizInputScreen(modifier: Modifier, viewModel: StartExamViewMo
),
type = QuackLargeButtonType.Fill,
text = stringResource(id = R.string.start_exam_start_button),
enabled = viewModel.startExamValidate(),
enabled = certifyingStatementText.isNotEmpty(),
onClick = viewModel::startSolveProblem,
)
ImeSpacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ internal class StartExamViewModel @Inject constructor(
val examId = savedStateHandle.getStateFlow(Extras.ExamId, -1).value
val isQuiz = savedStateHandle.getStateFlow(Extras.IsQuiz, false).value
if (isQuiz) {
val requirementQuestion = savedStateHandle.getOrThrow<String>(Extras.RequirementQuestion)
val requirementPlaceholder = savedStateHandle.getOrThrow<String>(Extras.RequirementPlaceholder)
val requirementQuestion =
savedStateHandle.getOrThrow<String>(Extras.RequirementQuestion)
val requirementPlaceholder =
savedStateHandle.getOrThrow<String>(Extras.RequirementPlaceholder)
val timer = savedStateHandle.getOrThrow<Int>(Extras.Timer)
reduce {
StartExamState.Input(
Expand All @@ -46,7 +48,8 @@ internal class StartExamViewModel @Inject constructor(
)
}
} else {
val certifyingStatement = savedStateHandle.getOrThrow<String>(Extras.CertifyingStatement)
val certifyingStatement =
savedStateHandle.getOrThrow<String>(Extras.CertifyingStatement)
reduce {
StartExamState.Input(
examId = examId,
Expand Down Expand Up @@ -75,7 +78,11 @@ internal class StartExamViewModel @Inject constructor(
val inputState = state as StartExamState.Input
postSideEffect(
StartExamSideEffect.NavigateToSolveProblem(
certified = startExamValidate(),
certified = if (inputState.isQuiz) {
true
} else {
startExamValidate()
},
examId = inputState.examId,
isQuiz = inputState.isQuiz,
),
Expand Down

0 comments on commit 4079d64

Please sign in to comment.