Skip to content

Commit cba9a67

Browse files
committed
Refactor: isCompleted를 computed property로 변경
1 parent 26efa55 commit cba9a67

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.threegap.bitnagil.domain.routine.model
22

33
data class RoutineToggleState(
4-
val isCompleted: Boolean,
54
val subRoutinesIsCompleted: List<Boolean>,
6-
)
5+
) {
6+
val isCompleted: Boolean
7+
get() = subRoutinesIsCompleted.all { it }
8+
}

domain/src/main/java/com/threegap/bitnagil/domain/routine/usecase/ToggleRoutineUseCase.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class ToggleRoutineUseCase @Inject constructor() {
2121
val newSubRoutineStates = subRoutineStates.map { newIsCompleted }
2222

2323
return RoutineToggleState(
24-
isCompleted = newIsCompleted,
2524
subRoutinesIsCompleted = newSubRoutineStates,
2625
)
2726
}
@@ -47,10 +46,7 @@ class ToggleRoutineUseCase @Inject constructor() {
4746
this[index] = newState
4847
}
4948

50-
val allCompleted = newSubRoutineStates.all { it }
51-
5249
return RoutineToggleState(
53-
isCompleted = allCompleted,
5450
subRoutinesIsCompleted = newSubRoutineStates,
5551
)
5652
}

0 commit comments

Comments
 (0)