mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Merge branch 'master' into dev
This commit is contained in:
@@ -149,7 +149,7 @@ class HabitsCSVExporter(
|
||||
|
||||
val timeframe = getTimeframe()
|
||||
val oldest = timeframe[0]
|
||||
val newest = DateUtils.getToday()
|
||||
val newest = DateUtils.getTodayWithOffset()
|
||||
val checkmarks: MutableList<ArrayList<Entry>> = ArrayList()
|
||||
val scores: MutableList<ArrayList<Score>> = ArrayList()
|
||||
for (habit in selectedHabits) {
|
||||
|
||||
@@ -204,9 +204,16 @@ open class EntryList {
|
||||
// Copy original entries
|
||||
original.forEach { entry ->
|
||||
val offset = entry.timestamp.daysUntil(to)
|
||||
if (result[offset].value == UNKNOWN || entry.value == SKIP || entry.value == YES_MANUAL) {
|
||||
result[offset] = entry
|
||||
val value = if (
|
||||
result[offset].value == UNKNOWN ||
|
||||
entry.value == SKIP ||
|
||||
entry.value == YES_MANUAL
|
||||
) {
|
||||
entry.value
|
||||
} else {
|
||||
YES_AUTO
|
||||
}
|
||||
result[offset] = Entry(entry.timestamp, value, entry.notes)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -57,7 +57,7 @@ class BarCardPresenter(
|
||||
} else {
|
||||
boolBucketSizes[boolSpinnerPosition]
|
||||
}
|
||||
val today = DateUtils.getToday()
|
||||
val today = DateUtils.getTodayWithOffset()
|
||||
val oldest = habit.computedEntries.getKnown().lastOrNull()?.timestamp ?: today
|
||||
val entries = habit.computedEntries.getByInterval(oldest, today).groupedSum(
|
||||
truncateField = ScoreCardPresenter.getTruncateField(bucketSize),
|
||||
|
||||
@@ -91,7 +91,6 @@ class HistoryCardPresenter(
|
||||
screen.showCheckmarkPopup(
|
||||
entry.value,
|
||||
entry.notes,
|
||||
preferences,
|
||||
habit.color,
|
||||
) { newValue, newNotes ->
|
||||
commandRunner.run(
|
||||
@@ -130,7 +129,6 @@ class HistoryCardPresenter(
|
||||
screen.showNumberPopup(
|
||||
value = oldValue / 1000.0,
|
||||
notes = entry.notes,
|
||||
preferences = preferences,
|
||||
) { newValue: Double, newNotes: String ->
|
||||
val thousands = (newValue * 1000).roundToInt()
|
||||
commandRunner.run(
|
||||
@@ -203,13 +201,11 @@ class HistoryCardPresenter(
|
||||
fun showNumberPopup(
|
||||
value: Double,
|
||||
notes: String,
|
||||
preferences: Preferences,
|
||||
callback: ListHabitsBehavior.NumberPickerCallback,
|
||||
)
|
||||
fun showCheckmarkPopup(
|
||||
selectedValue: Int,
|
||||
notes: String,
|
||||
preferences: Preferences,
|
||||
color: PaletteColor,
|
||||
callback: ListHabitsBehavior.CheckMarkDialogCallback,
|
||||
)
|
||||
|
||||
@@ -217,7 +217,7 @@ class EntryListTest {
|
||||
fun testAddFromInterval() {
|
||||
val entries = listOf(
|
||||
Entry(day(1), YES_MANUAL),
|
||||
Entry(day(2), NO),
|
||||
Entry(day(2), NO, "Test"),
|
||||
Entry(day(4), NO),
|
||||
Entry(day(5), YES_MANUAL),
|
||||
Entry(day(10), YES_MANUAL),
|
||||
@@ -230,7 +230,7 @@ class EntryListTest {
|
||||
)
|
||||
val expected = listOf(
|
||||
Entry(day(1), YES_MANUAL),
|
||||
Entry(day(2), YES_AUTO),
|
||||
Entry(day(2), YES_AUTO, "Test"),
|
||||
Entry(day(3), UNKNOWN),
|
||||
Entry(day(4), YES_AUTO),
|
||||
Entry(day(5), YES_MANUAL),
|
||||
|
||||
Reference in New Issue
Block a user