modify review comments

pull/1101/head
KristianTashkov 4 years ago
parent 17ed85fc1b
commit 07e55f1c76

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

@ -117,7 +117,7 @@ class HistoryCardPresenter(
} else { } else {
entries.map { entries.map {
when { 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 else -> HistoryChart.Square.OFF
} }
} }

Loading…
Cancel
Save