Skip to content

Commit

Permalink
NSC: process objective 0 properly
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosKozak committed Jan 17, 2024
1 parent b50a270 commit 172075e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 172075e

Please sign in to comment.