fix lst bolus query and smb pocessing
This commit is contained in:
parent
74dfe80433
commit
c0dba456d7
|
@ -170,7 +170,9 @@ open class LoopPlugin @Inject constructor(
|
|||
|
||||
override var enabled: Boolean
|
||||
get() = isEnabled()
|
||||
set(value) { setPluginEnabled(PluginType.LOOP, value)}
|
||||
set(value) {
|
||||
setPluginEnabled(PluginType.LOOP, value)
|
||||
}
|
||||
|
||||
val isLGS: Boolean
|
||||
get() {
|
||||
|
@ -209,6 +211,17 @@ open class LoopPlugin @Inject constructor(
|
|||
invoke(initiator, allowNotification, false)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun isEmptyQueue(): Boolean {
|
||||
val maxMinutes = 2L
|
||||
val start = dateUtil.now()
|
||||
while (start + T.mins(maxMinutes).msecs() > dateUtil.now()) {
|
||||
if (commandQueue.size() == 0 && commandQueue.performing() == null) return true
|
||||
SystemClock.sleep(100)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
operator fun invoke(initiator: String, allowNotification: Boolean, tempBasalFallback: Boolean) {
|
||||
try {
|
||||
|
@ -247,6 +260,12 @@ open class LoopPlugin @Inject constructor(
|
|||
return
|
||||
} else rxBus.send(EventLoopInvoked())
|
||||
|
||||
if (!isEmptyQueue()) {
|
||||
aapsLogger.debug(LTag.APS, resourceHelper.gs(R.string.pumpbusy))
|
||||
rxBus.send(EventLoopSetLastRunGui(resourceHelper.gs(R.string.pumpbusy)))
|
||||
return
|
||||
}
|
||||
|
||||
// Prepare for pumps using % basals
|
||||
if (pump.pumpDescription.tempBasalStyle == PumpDescription.PERCENT && allowPercentage()) {
|
||||
apsResult.usePercent = true
|
||||
|
@ -357,8 +376,7 @@ open class LoopPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
if (resultAfterConstraints.isChangeRequested
|
||||
&& !commandQueue.bolusInQueue()
|
||||
&& !commandQueue.isRunning(Command.CommandType.BOLUS)) {
|
||||
&& !commandQueue.bolusInQueue()) {
|
||||
val waiting = PumpEnactResult(injector)
|
||||
waiting.queued = true
|
||||
if (resultAfterConstraints.tempBasalRequested) lastRun.tbrSetByPump = waiting
|
||||
|
|
|
@ -202,11 +202,11 @@ open class CommandQueue @Inject constructor(
|
|||
@Synchronized
|
||||
override fun bolusInQueue(): Boolean {
|
||||
if (isRunning(CommandType.BOLUS)) return true
|
||||
if (isRunning(CommandType.SMB_BOLUS)) return true
|
||||
synchronized(queue) {
|
||||
for (i in queue.indices) {
|
||||
if (queue[i].commandType == CommandType.BOLUS) {
|
||||
return true
|
||||
}
|
||||
if (queue[i].commandType == CommandType.BOLUS) return true
|
||||
if (queue[i].commandType == CommandType.SMB_BOLUS) return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -243,13 +243,15 @@ open class CommandQueue @Inject constructor(
|
|||
}
|
||||
var type = if (detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) CommandType.SMB_BOLUS else CommandType.BOLUS
|
||||
if (type == CommandType.SMB_BOLUS) {
|
||||
if (isRunning(CommandType.BOLUS) || isRunning(CommandType.SMB_BOLUS) || bolusInQueue()) {
|
||||
if (bolusInQueue()) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting SMB since a bolus is queue/running")
|
||||
callback?.result(PumpEnactResult(injector).enacted(false).success(false))?.run()
|
||||
return false
|
||||
}
|
||||
val lastBolusTime = repository.getLastBolusRecord()?.timestamp ?: 0L
|
||||
if (detailedBolusInfo.lastKnownBolusTime < lastBolusTime) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting bolus, another bolus was issued since request time")
|
||||
callback?.result(PumpEnactResult(injector).enacted(false).success(false))?.run()
|
||||
return false
|
||||
}
|
||||
removeAll(CommandType.SMB_BOLUS)
|
||||
|
|
|
@ -23,6 +23,7 @@ class CommandSMBBolus(
|
|||
override fun execute() {
|
||||
val r: PumpEnactResult
|
||||
val lastBolusTime = repository.getLastBolusRecord()?.timestamp ?: 0L
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "Last bolus: $lastBolusTime ${dateUtil.dateAndTimeAndSecondsString(lastBolusTime)}")
|
||||
if (lastBolusTime != 0L && lastBolusTime + T.mins(3).msecs() > dateUtil.now()) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "SMB requested but still in 3 min interval")
|
||||
r = PumpEnactResult(injector).enacted(false).success(false).comment("SMB requested but still in 3 min interval")
|
||||
|
|
|
@ -70,7 +70,7 @@ class PumpSyncImplementation @Inject constructor(
|
|||
|
||||
if (type.description != storedType || serialNumber != storedSerial)
|
||||
rxBus.send(EventNewNotification(Notification(Notification.WRONG_PUMP_DATA, resourceHelper.gs(R.string.wrong_pump_data), Notification.URGENT)))
|
||||
aapsLogger.error(LTag.PUMP, "Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${dateUtil.dateAndTimeAndSecondsString(timestamp)}${type.description} $serialNumber")
|
||||
aapsLogger.error(LTag.PUMP, "Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${dateUtil.dateAndTimeAndSecondsString(timestamp)} ${type.description} $serialNumber")
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -118,14 +118,13 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
val param1 = intFromBuffMsbLsb(data, 7, 2)
|
||||
val param2 = intFromBuffMsbLsb(data, 9, 2)
|
||||
val pumpId: Long
|
||||
var id = 0
|
||||
if (!danaPump.usingUTC) {
|
||||
datetime = dateTimeSecFromBuff(data, 1) // 6 bytes
|
||||
pumpId = datetime
|
||||
} else {
|
||||
datetime = intFromBuffMsbLsb(data, 3, 4) * 1000L
|
||||
id = intFromBuffMsbLsb(data, 0, 2) // range only 1-2000
|
||||
pumpId = datetime shl 16 + id
|
||||
val id = intFromBuffMsbLsb(data, 0, 2) // range only 1-2000
|
||||
pumpId = datetime * 2 + id
|
||||
}
|
||||
val status: String
|
||||
when (recordCode) {
|
||||
|
@ -140,7 +139,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
status = "TEMPSTART " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -150,7 +149,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
endPumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "TEMPSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -163,7 +162,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "EXTENDEDSTART " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -173,7 +172,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
endPumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
status = "EXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -186,7 +185,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U ")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U ")
|
||||
status = "BOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -199,7 +198,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "DUALBOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -212,7 +211,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "DUALEXTENDEDSTART " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -222,17 +221,17 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
endPumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
status = "DUALEXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaPump.SUSPENDON -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "EVENT SUSPENDON (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "EVENT SUSPENDON (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDON " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaPump.SUSPENDOFF -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "EVENT SUSPENDOFF (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "EVENT SUSPENDOFF (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDOFF " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -245,18 +244,18 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpType = danaPump.pumpType(),
|
||||
pumpSerial = danaPump.serialNumber
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT REFILL (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT REFILL (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
}
|
||||
status = "REFILL " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaPump.PRIME -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "EVENT PRIME (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "EVENT PRIME (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "PRIME " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaPump.PROFILECHANGE -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "EVENT PROFILECHANGE (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "EVENT PROFILECHANGE (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
status = "PROFILECHANGE " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -267,7 +266,7 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpId = pumpId,
|
||||
pumpType = PumpType.DANA_RS,
|
||||
pumpSerial = danaPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
status = "CARBS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -280,19 +279,19 @@ open class DanaRSPacketAPSHistoryEvents(
|
|||
pumpType = danaPump.pumpType(),
|
||||
pumpSerial = danaPump.serialNumber
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + (if (newRecord) "**NEW** " else "") + "EVENT PRIMECANNULA(" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + (if (newRecord) "**NEW** " else "") + "EVENT PRIMECANNULA(" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
}
|
||||
status = "PRIMECANNULA " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaPump.TIMECHANGE -> {
|
||||
val oldDateTime = intFromBuffMsbLsb(data, 7, 4) * 1000L
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "EVENT TIMECHANGE(" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Previous: " + dateUtil.dateAndTimeString(oldDateTime))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "EVENT TIMECHANGE(" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Previous: " + dateUtil.dateAndTimeString(oldDateTime))
|
||||
status = "TIMECHANGE " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
else -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + id + "] " + "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "[" + pumpId + "] " + "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
status = "UNKNOWN " + dateUtil.timeString(datetime)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,16 +33,16 @@ internal interface BolusDao : TraceableDao<Bolus> {
|
|||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE temporaryId = :temporaryId AND pumpType = :pumpType AND pumpSerial = :pumpSerial AND referenceId IS NULL")
|
||||
fun findByPumpTempIds(temporaryId: Long, pumpType: InterfaceIDs.PumpType, pumpSerial: String): Bolus?
|
||||
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY id ASC LIMIT 1")
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY timestamp DESC LIMIT 1")
|
||||
fun getLastBolusRecord(exclude: Bolus.Type = Bolus.Type.PRIMING): Bolus?
|
||||
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY id ASC LIMIT 1")
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY timestamp DESC LIMIT 1")
|
||||
fun getLastBolusRecordMaybe(exclude: Bolus.Type = Bolus.Type.PRIMING): Maybe<Bolus>
|
||||
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type == :only AND referenceId IS NULL ORDER BY id ASC LIMIT 1")
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type == :only AND referenceId IS NULL ORDER BY timestamp DESC LIMIT 1")
|
||||
fun getLastBolusRecordOfType(only: Bolus.Type): Bolus?
|
||||
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY id ASC LIMIT 1")
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND type <> :exclude AND referenceId IS NULL ORDER BY timestamp ASC LIMIT 1")
|
||||
fun getOldestBolusRecord(exclude: Bolus.Type = Bolus.Type.PRIMING): Bolus?
|
||||
|
||||
@Query("SELECT * FROM $TABLE_BOLUSES WHERE isValid = 1 AND timestamp >= :timestamp AND referenceId IS NULL ORDER BY id DESC")
|
||||
|
|
Loading…
Reference in a new issue