fix loading last value

This commit is contained in:
Milos Kozak 2022-09-22 20:24:27 +02:00
parent 408e2641dc
commit 8fb5c5a984

View file

@ -16,7 +16,7 @@ internal interface GlucoseValueDao : TraceableDao<GlucoseValue> {
@Query("DELETE FROM $TABLE_GLUCOSE_VALUES")
override fun deleteAllEntries()
@Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE isValid = 1 AND referenceId IS NULL ORDER BY id DESC limit 1")
@Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE isValid = 1 AND referenceId IS NULL ORDER BY timestamp DESC limit 1")
fun getLast(): Maybe<GlucoseValue>
@Query("SELECT id FROM $TABLE_GLUCOSE_VALUES ORDER BY id DESC limit 1")