Merge pull request #749 from samspycher/fix/dash-history-since

Fix: inverse comparator in dash history DAO for `allSince`
This commit is contained in:
Milos Kozak 2021-10-18 09:05:23 +02:00 committed by GitHub
commit 7a340dbc07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import androidx.room.Room
import androidx.test.core.app.ApplicationProvider import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
import com.github.guepardoapps.kulid.ULID import com.github.guepardoapps.kulid.ULID
import info.nightscout.androidaps.logging.AAPSLoggerTest
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao
@ -34,7 +35,7 @@ class DashHistoryTest {
DashHistoryDatabase::class.java DashHistoryDatabase::class.java
).build() ).build()
dao = database.historyRecordDao() dao = database.historyRecordDao()
dashHistory = DashHistory(dao, HistoryMapper()) dashHistory = DashHistory(dao, HistoryMapper(), AAPSLoggerTest())
} }
@Test @Test

View file

@ -19,7 +19,7 @@ abstract class HistoryRecordDao {
@Query("SELECT * from historyrecords") @Query("SELECT * from historyrecords")
abstract fun allBlocking(): List<HistoryRecordEntity> abstract fun allBlocking(): List<HistoryRecordEntity>
@Query("SELECT * from historyrecords WHERE createdAt <= :since") @Query("SELECT * from historyrecords WHERE createdAt >= :since")
abstract fun allSince(since: Long): Single<List<HistoryRecordEntity>> abstract fun allSince(since: Long): Single<List<HistoryRecordEntity>>
@Query("SELECT * FROM historyrecords WHERE id = :id LIMIT 1") @Query("SELECT * FROM historyrecords WHERE id = :id LIMIT 1")