File tree Expand file tree Collapse file tree
presentation/src/main/java/com/threegap/bitnagil/presentation/home Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,21 +300,15 @@ class HomeViewModel @Inject constructor(
300300
301301 val routine = routinesForDate[routineIndex]
302302
303- if (subRoutineIndex < 0 || subRoutineIndex >= routine.subRoutineNames.size ) {
303+ if (subRoutineIndex !in routine.subRoutineCompleteYn.indices ) {
304304 return @updateRoutinesForDate false
305305 }
306306
307- val updatedSubRoutineCompleteYn = routine.subRoutineCompleteYn.toMutableList().apply {
308- if (subRoutineIndex < size) {
309- this [subRoutineIndex] = isCompleted
310- }
307+ val updatedSubRoutineCompleteYn = routine.subRoutineCompleteYn.toMutableList().also {
308+ it[subRoutineIndex] = isCompleted
311309 }
312310
313- val routineCompleted = if (isCompleted) {
314- updatedSubRoutineCompleteYn.all { it }
315- } else {
316- false
317- }
311+ val routineCompleted = updatedSubRoutineCompleteYn.all { it }
318312
319313 val updatedRoutine = routine.copy(
320314 subRoutineCompleteYn = updatedSubRoutineCompleteYn,
You can’t perform that action at this time.
0 commit comments