mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
EntryList: Make groupBy always return thousandths
This commit is contained in:
@@ -102,7 +102,7 @@ open class EntryList {
|
||||
}
|
||||
} else {
|
||||
if (truncated[i].value == YES_MANUAL) {
|
||||
values[values.lastIndex] += 1
|
||||
values[values.lastIndex] += 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,9 +217,9 @@ class EntryListTest {
|
||||
isNumerical = false,
|
||||
)
|
||||
assertThat(byMonth.size, equalTo(17))
|
||||
assertThat(byMonth[0], equalTo(Entry(Timestamp.from(2014, Calendar.JUNE, 1), 1)))
|
||||
assertThat(byMonth[6], equalTo(Entry(Timestamp.from(2013, Calendar.DECEMBER, 1), 7)))
|
||||
assertThat(byMonth[12], equalTo(Entry(Timestamp.from(2013, Calendar.MAY, 1), 6)))
|
||||
assertThat(byMonth[0], equalTo(Entry(Timestamp.from(2014, Calendar.JUNE, 1), 1_000)))
|
||||
assertThat(byMonth[6], equalTo(Entry(Timestamp.from(2013, Calendar.DECEMBER, 1), 7_000)))
|
||||
assertThat(byMonth[12], equalTo(Entry(Timestamp.from(2013, Calendar.MAY, 1), 6_000)))
|
||||
|
||||
val byQuarter = entries.groupBy(
|
||||
original = entries.getKnown(),
|
||||
@@ -228,9 +228,9 @@ class EntryListTest {
|
||||
isNumerical = true,
|
||||
)
|
||||
assertThat(byQuarter.size, equalTo(6))
|
||||
assertThat(byQuarter[0], equalTo(Entry(Timestamp.from(2014, Calendar.APRIL, 1), 30)))
|
||||
assertThat(byQuarter[3], equalTo(Entry(Timestamp.from(2013, Calendar.JULY, 1), 34)))
|
||||
assertThat(byQuarter[5], equalTo(Entry(Timestamp.from(2013, Calendar.JANUARY, 1), 40)))
|
||||
assertThat(byQuarter[0], equalTo(Entry(Timestamp.from(2014, Calendar.APRIL, 1), 30_000)))
|
||||
assertThat(byQuarter[3], equalTo(Entry(Timestamp.from(2013, Calendar.JULY, 1), 34_000)))
|
||||
assertThat(byQuarter[5], equalTo(Entry(Timestamp.from(2013, Calendar.JANUARY, 1), 40_000)))
|
||||
|
||||
val byYear = entries.groupBy(
|
||||
original = entries.getKnown(),
|
||||
@@ -239,8 +239,8 @@ class EntryListTest {
|
||||
isNumerical = true,
|
||||
)
|
||||
assertThat(byYear.size, equalTo(2))
|
||||
assertThat(byYear[0], equalTo(Entry(Timestamp.from(2014, Calendar.JANUARY, 1), 68)))
|
||||
assertThat(byYear[1], equalTo(Entry(Timestamp.from(2013, Calendar.JANUARY, 1), 132)))
|
||||
assertThat(byYear[0], equalTo(Entry(Timestamp.from(2014, Calendar.JANUARY, 1), 68_000)))
|
||||
assertThat(byYear[1], equalTo(Entry(Timestamp.from(2013, Calendar.JANUARY, 1), 132_000)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user