NSC: do not sync records with tempId

This commit is contained in:
Milos Kozak 2023-08-29 21:44:22 +02:00
parent 16001a6c12
commit 394883165d
2 changed files with 4 additions and 4 deletions

View file

@ -63,11 +63,11 @@ internal interface BolusDao : TraceableDao<Bolus> {
fun getBolusesIncludingInvalidFromTimeToTime(from: Long, to: Long): Single<List<Bolus>>
// This query will be used with v3 to get all changed records
@Query("SELECT * FROM $TABLE_BOLUSES WHERE id > :id AND type <> :exclude AND referenceId IS NULL OR id IN (SELECT DISTINCT referenceId FROM $TABLE_BOLUSES WHERE id > :id) ORDER BY id ASC")
@Query("SELECT * FROM $TABLE_BOLUSES WHERE id > :id AND pumpId IS NOT NULL AND type <> :exclude AND referenceId IS NULL OR id IN (SELECT DISTINCT referenceId FROM $TABLE_BOLUSES WHERE id > :id) ORDER BY id ASC")
fun getModifiedFrom(id: Long, exclude: Bolus.Type = Bolus.Type.PRIMING): Single<List<Bolus>>
// for WS we need 1 record only
@Query("SELECT * FROM $TABLE_BOLUSES WHERE id > :id AND type <> :exclude ORDER BY id ASC limit 1")
@Query("SELECT * FROM $TABLE_BOLUSES WHERE id > :id AND pumpId IS NOT NULL AND type <> :exclude ORDER BY id ASC limit 1")
fun getNextModifiedOrNewAfterExclude(id: Long, exclude: Bolus.Type = Bolus.Type.PRIMING): Maybe<Bolus>
@Query("SELECT * FROM $TABLE_BOLUSES WHERE id = :referenceId")

View file

@ -72,11 +72,11 @@ internal interface TemporaryBasalDao : TraceableDao<TemporaryBasal> {
fun getLastHistoryRecord(id: Long): TemporaryBasal?
// This query will be used with v3 to get all changed records
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE id > :id AND referenceId IS NULL OR id IN (SELECT DISTINCT referenceId FROM $TABLE_TEMPORARY_BASALS WHERE id > :id) ORDER BY id ASC")
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE id > :id AND pumpId IS NOT NULL AND referenceId IS NULL OR id IN (SELECT DISTINCT referenceId FROM $TABLE_TEMPORARY_BASALS WHERE id > :id) ORDER BY id ASC")
fun getModifiedFrom(id: Long): Single<List<TemporaryBasal>>
// for WS we need 1 record only
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE id > :id ORDER BY id ASC limit 1")
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE id > :id AND pumpId IS NOT NULL ORDER BY id ASC limit 1")
fun getNextModifiedOrNewAfter(id: Long): Maybe<TemporaryBasal>
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE id = :referenceId")