fix NS sync issue
This commit is contained in:
parent
49776c8872
commit
e08af1e7e4
|
@ -6,7 +6,9 @@ class UpdateNsIdBolusCalculatorResultTransaction(val bolusCalculatorResult: Bolu
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.bolusCalculatorResultDao.findById(bolusCalculatorResult.id)
|
val current = database.bolusCalculatorResultDao.findById(bolusCalculatorResult.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != bolusCalculatorResult.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != bolusCalculatorResult.interfaceIDs.nightscoutId) {
|
||||||
database.bolusCalculatorResultDao.updateExistingEntry(bolusCalculatorResult)
|
current.interfaceIDs.nightscoutId = bolusCalculatorResult.interfaceIDs.nightscoutId
|
||||||
|
database.bolusCalculatorResultDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdBolusTransaction(val bolus: Bolus) : Transaction<Unit>() {
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.bolusDao.findById(bolus.id)
|
val current = database.bolusDao.findById(bolus.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != bolus.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != bolus.interfaceIDs.nightscoutId) {
|
||||||
database.bolusDao.updateExistingEntry(bolus)
|
current.interfaceIDs.nightscoutId = bolus.interfaceIDs.nightscoutId
|
||||||
|
database.bolusDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdCarbsTransaction(val carbs: Carbs) : Transaction<Unit>() {
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.carbsDao.findById(carbs.id)
|
val current = database.carbsDao.findById(carbs.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != carbs.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != carbs.interfaceIDs.nightscoutId) {
|
||||||
database.carbsDao.updateExistingEntry(carbs)
|
current.interfaceIDs.nightscoutId = carbs.interfaceIDs.nightscoutId
|
||||||
|
database.carbsDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdDeviceStatusTransaction(val deviceStatus: DeviceStatus) : Transa
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.deviceStatusDao.findById(deviceStatus.id)
|
val current = database.deviceStatusDao.findById(deviceStatus.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != deviceStatus.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != deviceStatus.interfaceIDs.nightscoutId) {
|
||||||
database.deviceStatusDao.update(deviceStatus)
|
current.interfaceIDs.nightscoutId = deviceStatus.interfaceIDs.nightscoutId
|
||||||
|
database.deviceStatusDao.update(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdExtendedBolusTransaction(val bolus: ExtendedBolus) : Transaction
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.extendedBolusDao.findById(bolus.id)
|
val current = database.extendedBolusDao.findById(bolus.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != bolus.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != bolus.interfaceIDs.nightscoutId) {
|
||||||
database.extendedBolusDao.updateExistingEntry(bolus)
|
current.interfaceIDs.nightscoutId = bolus.interfaceIDs.nightscoutId
|
||||||
|
database.extendedBolusDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdFoodTransaction(val food: Food) : Transaction<Unit>() {
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.foodDao.findById(food.id)
|
val current = database.foodDao.findById(food.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != food.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != food.interfaceIDs.nightscoutId) {
|
||||||
database.foodDao.updateExistingEntry(food)
|
current.interfaceIDs.nightscoutId = food.interfaceIDs.nightscoutId
|
||||||
|
database.foodDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdGlucoseValueTransaction(val glucoseValue: GlucoseValue) : Transa
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.glucoseValueDao.findById(glucoseValue.id)
|
val current = database.glucoseValueDao.findById(glucoseValue.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != glucoseValue.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != glucoseValue.interfaceIDs.nightscoutId) {
|
||||||
database.glucoseValueDao.updateExistingEntry(glucoseValue)
|
current.interfaceIDs.nightscoutId = glucoseValue.interfaceIDs.nightscoutId
|
||||||
|
database.glucoseValueDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdOfflineEventTransaction(val offlineEvent: OfflineEvent) : Transa
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.offlineEventDao.findById(offlineEvent.id)
|
val current = database.offlineEventDao.findById(offlineEvent.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != offlineEvent.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != offlineEvent.interfaceIDs.nightscoutId) {
|
||||||
database.offlineEventDao.updateExistingEntry(offlineEvent)
|
current.interfaceIDs.nightscoutId = offlineEvent.interfaceIDs.nightscoutId
|
||||||
|
database.offlineEventDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdProfileSwitchTransaction(val profileSwitch: ProfileSwitch) : Tra
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.profileSwitchDao.findById(profileSwitch.id)
|
val current = database.profileSwitchDao.findById(profileSwitch.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != profileSwitch.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != profileSwitch.interfaceIDs.nightscoutId) {
|
||||||
database.profileSwitchDao.updateExistingEntry(profileSwitch)
|
current.interfaceIDs.nightscoutId = profileSwitch.interfaceIDs.nightscoutId
|
||||||
|
database.profileSwitchDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,11 +2,13 @@ package info.nightscout.androidaps.database.transactions
|
||||||
|
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
import info.nightscout.androidaps.database.entities.TemporaryBasal
|
||||||
|
|
||||||
class UpdateNsIdTemporaryBasalTransaction(val bolus: TemporaryBasal) : Transaction<Unit>() {
|
class UpdateNsIdTemporaryBasalTransaction(val temporaryBasal: TemporaryBasal) : Transaction<Unit>() {
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.temporaryBasalDao.findById(bolus.id)
|
val current = database.temporaryBasalDao.findById(temporaryBasal.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != bolus.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != temporaryBasal.interfaceIDs.nightscoutId) {
|
||||||
database.temporaryBasalDao.updateExistingEntry(bolus)
|
current.interfaceIDs.nightscoutId = temporaryBasal.interfaceIDs.nightscoutId
|
||||||
|
database.temporaryBasalDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdTemporaryTargetTransaction(val temporaryTarget: TemporaryTarget)
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.temporaryTargetDao.findById(temporaryTarget.id)
|
val current = database.temporaryTargetDao.findById(temporaryTarget.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != temporaryTarget.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != temporaryTarget.interfaceIDs.nightscoutId) {
|
||||||
database.temporaryTargetDao.updateExistingEntry(temporaryTarget)
|
current.interfaceIDs.nightscoutId = temporaryTarget.interfaceIDs.nightscoutId
|
||||||
|
database.temporaryTargetDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@ class UpdateNsIdTherapyEventTransaction(val therapyEvent: TherapyEvent) : Transa
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val current = database.therapyEventDao.findById(therapyEvent.id)
|
val current = database.therapyEventDao.findById(therapyEvent.id)
|
||||||
if (current != null && current.interfaceIDs.nightscoutId != therapyEvent.interfaceIDs.nightscoutId)
|
if (current != null && current.interfaceIDs.nightscoutId != therapyEvent.interfaceIDs.nightscoutId) {
|
||||||
database.therapyEventDao.updateExistingEntry(therapyEvent)
|
current.interfaceIDs.nightscoutId = therapyEvent.interfaceIDs.nightscoutId
|
||||||
|
database.therapyEventDao.updateExistingEntry(current)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue