modify review comments

This commit is contained in:
KristianTashkov
2021-09-26 22:58:24 +03:00
parent 17ed85fc1b
commit 07e55f1c76
2 changed files with 5 additions and 7 deletions

View File

@@ -59,10 +59,9 @@ data class Habit(
val today = DateUtils.getTodayWithOffset()
val value = computedEntries.get(today).value
return if (isNumerical) {
val targetValuePerDay = (targetValue / frequency.denominator)
when (targetType) {
NumericalHabitType.AT_LEAST -> value / 1000.0 >= targetValuePerDay
NumericalHabitType.AT_MOST -> value / 1000.0 <= targetValuePerDay
NumericalHabitType.AT_LEAST -> value / 1000.0 >= targetValue
NumericalHabitType.AT_MOST -> value / 1000.0 <= targetValue
}
} else {
value != Entry.NO && value != Entry.UNKNOWN
@@ -73,10 +72,9 @@ data class Habit(
val today = DateUtils.getTodayWithOffset()
val value = computedEntries.get(today).value
return if (isNumerical) {
val targetValuePerDay = (targetValue / frequency.denominator)
when (targetType) {
NumericalHabitType.AT_LEAST -> value / 1000.0 < targetValuePerDay
NumericalHabitType.AT_MOST -> value / 1000.0 > targetValuePerDay
NumericalHabitType.AT_LEAST -> value / 1000.0 < targetValue
NumericalHabitType.AT_MOST -> value / 1000.0 > targetValue
}
} else {
value == Entry.NO

View File

@@ -117,7 +117,7 @@ class HistoryCardPresenter(
} else {
entries.map {
when {
max(0.0, it.value / 1000.0) < 2 * habit.targetValue -> HistoryChart.Square.ON
max(0.0, it.value / 1000.0) <= habit.targetValue -> HistoryChart.Square.ON
else -> HistoryChart.Square.OFF
}
}