From da76506e01eeac41d81a68fd311057fc2eaec2a2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Feb 2023 15:16:06 +0100 Subject: [PATCH] fix tests --- .../main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt b/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt index c6aec5a1b4..96b2f8905f 100644 --- a/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt +++ b/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt @@ -82,8 +82,9 @@ internal fun RemoteTreatment.toTreatment(): NSTreatment? { if (treatmentTimestamp == 0L) return null this.duration ?: return null + val durationInMilliseconds = this.durationInMilliseconds ?: TimeUnit.MINUTES.toMillis(this.duration) - if (duration == 0L) + if (durationInMilliseconds == 0L) return NSTemporaryTarget( date = treatmentTimestamp, device = this.device, @@ -127,7 +128,7 @@ internal fun RemoteTreatment.toTreatment(): NSTreatment? { endId = this.endId, pumpType = this.pumpType, pumpSerial = this.pumpSerial, - duration = this.durationInMilliseconds ?: TimeUnit.MINUTES.toMillis(this.duration), + duration = durationInMilliseconds, targetBottom = this.targetBottom, targetTop = this.targetTop, reason = NSTemporaryTarget.Reason.fromString(this.reason)