NSC: accept Temporary target cancel from AAPSClient
This commit is contained in:
parent
0569d2ba0a
commit
2b7c082979
2 changed files with 3 additions and 3 deletions
|
@ -7,7 +7,7 @@ import kotlin.math.abs
|
|||
/**
|
||||
* Sync the TemporaryTarget from NS
|
||||
*/
|
||||
class SyncNsTemporaryTargetTransaction(private val temporaryTargets: List<TemporaryTarget>, private val nsClientMode: Boolean) :
|
||||
class SyncNsTemporaryTargetTransaction(private val temporaryTargets: List<TemporaryTarget>) :
|
||||
Transaction<SyncNsTemporaryTargetTransaction.TransactionResult>() {
|
||||
|
||||
override fun run(): TransactionResult {
|
||||
|
@ -28,7 +28,7 @@ class SyncNsTemporaryTargetTransaction(private val temporaryTargets: List<Tempor
|
|||
database.temporaryTargetDao.updateExistingEntry(current)
|
||||
result.invalidated.add(current)
|
||||
}
|
||||
if (current.duration != temporaryTarget.duration && nsClientMode) {
|
||||
if (current.duration != temporaryTarget.duration) {
|
||||
current.duration = temporaryTarget.duration
|
||||
database.temporaryTargetDao.updateExistingEntry(current)
|
||||
result.updatedDuration.add(current)
|
||||
|
|
|
@ -325,7 +325,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
SystemClock.sleep(pause)
|
||||
|
||||
if (temporaryTargets.isNotEmpty())
|
||||
repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTargets, config.NSCLIENT))
|
||||
repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTargets))
|
||||
.doOnError {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue