mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
Replace RepetitionList by Entries
This commit is contained in:
@@ -52,7 +52,9 @@ class FrequencyCardPresenter(
|
||||
) {
|
||||
fun present() = FrequencyCardViewModel(
|
||||
color = habit.color,
|
||||
frequency = habit.originalEntries.weekdayFrequency,
|
||||
frequency = habit.originalEntries.computeWeekdayFrequency(
|
||||
isNumerical = habit.isNumerical
|
||||
),
|
||||
firstWeekday = firstWeekday,
|
||||
)
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import android.widget.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.isoron.uhabits.*
|
||||
import org.isoron.uhabits.core.models.*
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.YES_MANUAL
|
||||
import org.isoron.uhabits.core.utils.*
|
||||
import org.isoron.uhabits.databinding.*
|
||||
import org.isoron.uhabits.utils.*
|
||||
@@ -74,12 +75,16 @@ class OverviewCardPresenter(val habit: Habit) {
|
||||
val scoreToday = scores.todayValue.toFloat()
|
||||
val scoreLastMonth = scores.getValue(lastMonth).toFloat()
|
||||
val scoreLastYear = scores.getValue(lastYear).toFloat()
|
||||
val totalCount = habit.originalEntries.getKnown()
|
||||
.filter { it.value == YES_MANUAL }
|
||||
.count()
|
||||
.toLong()
|
||||
return@IO OverviewCardViewModel(
|
||||
color = habit.color,
|
||||
scoreToday = scoreToday,
|
||||
scoreMonthDiff = scoreToday - scoreLastMonth,
|
||||
scoreYearDiff = scoreToday - scoreLastYear,
|
||||
totalCount = habit.originalEntries.totalCount,
|
||||
totalCount = totalCount,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class FrequencyWidget(
|
||||
(widgetView.dataView as FrequencyChart).apply {
|
||||
setFirstWeekday(firstWeekday)
|
||||
setColor(habit.color.toThemedAndroidColor(context))
|
||||
setFrequency(habit.originalEntries.weekdayFrequency)
|
||||
setFrequency(habit.originalEntries.computeWeekdayFrequency(habit.isNumerical))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user