From 4406b60ecff7195266cba80bfc5b97346e94fe1e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 3 Aug 2023 11:05:31 +0200 Subject: [PATCH] NSCv3: fix TBR upload --- .../plugins/sync/nsclientV3/DataSyncSelectorV3Impl.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/DataSyncSelectorV3Impl.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/DataSyncSelectorV3Impl.kt index 8c79dfe1b3..7a3d88d400 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/DataSyncSelectorV3Impl.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/DataSyncSelectorV3Impl.kt @@ -489,6 +489,7 @@ class DataSyncSelectorV3Impl @Inject constructor( queueCounter.tbrsRemaining = lastDbId - startId rxBus.send(EventNSClientUpdateGuiQueue()) appRepository.getNextSyncElementTemporaryBasal(startId).blockingGet()?.let { tb -> + val profile = profileFunction.getProfile(tb.first.timestamp) //aapsLogger.info(LTag.NSCLIENT, "Loading TemporaryBasal data Start: $startId ${tb.first} forID: ${tb.second.id} ") when { // new record with existing NS id => must be coming from NS => ignore @@ -499,10 +500,10 @@ class DataSyncSelectorV3Impl @Inject constructor( aapsLogger.info(LTag.NSCLIENT, "Ignoring TemporaryBasal. Only NS id changed ID: ${tb.second.id} ") // without nsId = create new tb.first.interfaceIDs.nightscoutId == null -> - cont = activePlugin.activeNsClient?.nsAdd("treatments", DataSyncSelector.PairTemporaryBasal(tb.first, tb.second.id), "$startId/$lastDbId") ?: false + cont = activePlugin.activeNsClient?.nsAdd("treatments", DataSyncSelector.PairTemporaryBasal(tb.first, tb.second.id), "$startId/$lastDbId", profile) ?: false // with nsId = update tb.first.interfaceIDs.nightscoutId != null -> - cont = activePlugin.activeNsClient?.nsUpdate("treatments", DataSyncSelector.PairTemporaryBasal(tb.first, tb.second.id), "$startId/$lastDbId") ?: false + cont = activePlugin.activeNsClient?.nsUpdate("treatments", DataSyncSelector.PairTemporaryBasal(tb.first, tb.second.id), "$startId/$lastDbId", profile) ?: false } if (cont) confirmLastTemporaryBasalIdIfGreater(tb.second.id) } ?: run {