NSC: process objective 0 properly

This commit is contained in:
Milos Kozak 2024-01-17 13:16:39 +01:00 committed by Casper V. Kristensen
parent 1e5172a66a
commit 0d4d187775
3 changed files with 2 additions and 4 deletions

View file

@ -88,6 +88,8 @@ class NsIncomingDataProcessor @Inject constructor(
*/
@Suppress("SpellCheckingInspection")
fun processSgvs(sgvs: Any): Boolean {
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return false

View file

@ -561,8 +561,6 @@ class NSClientService : DaggerService() {
val sgvs = data.getJSONArray("sgvs")
if (sgvs.length() > 0) {
rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs"))
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
nsIncomingDataProcessor.processSgvs(sgvs)
storeDataForDb.storeGlucoseValuesToDb()
}

View file

@ -61,8 +61,6 @@ class LoadBgWorker(
if (sgvs.isNotEmpty()) {
val action = if (isFirstLoad) "RCV-F" else "RCV"
rxBus.send(EventNSClientNewLog("$action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}"))
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
// Schedule processing of fetched data and continue of loading
continueLoading = response.code != 304 && nsIncomingDataProcessor.processSgvs(sgvs)
} else {