Skip to content

Commit

Permalink
Merge pull request nightscout#41 from polscm32/fix-trend
Browse files Browse the repository at this point in the history
fix trend in watch manager & notifications -> fix issue nightscout#9
  • Loading branch information
dnzxy committed Aug 8, 2024
2 parents 511b6f4 + 4a09062 commit 29ae1e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In

guard let lastReading = glucoseObjects.first?.glucose,
let secondLastReading = glucoseObjects.dropFirst().first?.glucose,
let lastDirection = glucoseObjects.first?.direction else { return }
let lastDirection = glucoseObjects.first?.directionEnum?.symbol else { return }

addAppBadge(glucose: (glucoseObjects.first?.glucose).map { Int($0) })

Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Sources/Services/WatchManager/WatchManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ final class BaseWatchManager: NSObject, WatchManager, Injectable {
let value = settingsManager.settings
.units == .mgdL ? Decimal(firstGlucoseValue.glucose) : Decimal(firstGlucoseValue.glucose).asMmolL
state.glucose = glucoseFormatter.string(from: value as NSNumber)
state.trend = firstGlucoseValue.direction
state.trend = firstGlucoseValue.directionEnum?.symbol
let delta = glucoseValues
.count >= 2 ? Decimal(firstGlucoseValue.glucose) - Decimal(glucoseValues.dropFirst().first?.glucose ?? 0) : 0
let deltaConverted = settingsManager.settings.units == .mgdL ? delta : delta.asMmolL
Expand Down

0 comments on commit 29ae1e8

Please sign in to comment.