DATABASE: log with assigned id

This commit is contained in:
Milos Kozak 2023-08-28 23:54:15 +02:00
parent 4260ca7b11
commit 9eafb449b3
3 changed files with 2 additions and 15 deletions

View file

@ -15,7 +15,7 @@ class InsertBolusWithTempIdTransaction(
val result = TransactionResult() val result = TransactionResult()
val current = database.bolusDao.findByPumpTempIds(bolus.interfaceIDs.temporaryId!!, bolus.interfaceIDs.pumpType!!, bolus.interfaceIDs.pumpSerial!!) val current = database.bolusDao.findByPumpTempIds(bolus.interfaceIDs.temporaryId!!, bolus.interfaceIDs.pumpType!!, bolus.interfaceIDs.pumpSerial!!)
if (current == null) { if (current == null) {
database.bolusDao.insert(bolus) bolus.id = database.bolusDao.insert(bolus)
result.inserted.add(bolus) result.inserted.add(bolus)
} }
return result return result

View file

@ -1,13 +0,0 @@
package info.nightscout.database.impl.transactions
import info.nightscout.database.entities.GlucoseValue
/**
* Creates the GlucoseValue
*/
class InsertGlucoseValueTransaction(val glucoseValue: GlucoseValue) : Transaction<Unit>() {
override fun run() {
database.glucoseValueDao.insert(glucoseValue)
}
}

View file

@ -15,7 +15,7 @@ class InsertTemporaryBasalWithTempIdTransaction(private val temporaryBasal: Temp
val result = TransactionResult() val result = TransactionResult()
val current = database.temporaryBasalDao.findByPumpTempIds(temporaryBasal.interfaceIDs.temporaryId!!, temporaryBasal.interfaceIDs.pumpType!!, temporaryBasal.interfaceIDs.pumpSerial!!) val current = database.temporaryBasalDao.findByPumpTempIds(temporaryBasal.interfaceIDs.temporaryId!!, temporaryBasal.interfaceIDs.pumpType!!, temporaryBasal.interfaceIDs.pumpSerial!!)
if (current == null) { if (current == null) {
database.temporaryBasalDao.insert(temporaryBasal) temporaryBasal.id = database.temporaryBasalDao.insert(temporaryBasal)
result.inserted.add(temporaryBasal) result.inserted.add(temporaryBasal)
} }
return result return result