diff --git a/xDrip Watch App/DataModels/WatchStateModel.swift b/xDrip Watch App/DataModels/WatchStateModel.swift index a53779d3b..0c605abc8 100644 --- a/xDrip Watch App/DataModels/WatchStateModel.swift +++ b/xDrip Watch App/DataModels/WatchStateModel.swift @@ -189,13 +189,13 @@ final class WatchStateModel: NSObject, ObservableObject { // quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed // show unitized zero deltas as +0 or +0.0 as per Nightscout format if (isMgDl) { - if (deltaChangeInMgDl > -1) && (deltaChangeInMgDl < 1) { + if (deltaChangeInMgDl == 0) { return "+0" } else { return deltaSign + valueAsString } } else { - if (deltaChangeInMgDl > -0.1) && (deltaChangeInMgDl < 0.1) { + if (deltaChangeInMgDl == 0.0) { return "+0.0" } else { return deltaSign + valueAsString diff --git a/xDrip Watch Complication/XDripWatchComplication+Entry.swift b/xDrip Watch Complication/XDripWatchComplication+Entry.swift index f00f1f45a..1c3a4aa84 100644 --- a/xDrip Watch Complication/XDripWatchComplication+Entry.swift +++ b/xDrip Watch Complication/XDripWatchComplication+Entry.swift @@ -85,9 +85,9 @@ extension XDripWatchComplication.Entry { // quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed // show unitized zero deltas as +0 or +0.0 as per Nightscout format if (isMgDl) { - return (deltaChangeInMgDl > -1 && deltaChangeInMgDl < 1) ? "+0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0) ? "+0" : (deltaSign + valueAsString) } else { - return (deltaChangeInMgDl > -0.1 && deltaChangeInMgDl < 0.1) ? "+0.0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0.0) ? "+0.0" : (deltaSign + valueAsString) } } return "" diff --git a/xDrip Widget/DataModels/XDripWidgetAttributes.swift b/xDrip Widget/DataModels/XDripWidgetAttributes.swift index d26a26249..216a085be 100644 --- a/xDrip Widget/DataModels/XDripWidgetAttributes.swift +++ b/xDrip Widget/DataModels/XDripWidgetAttributes.swift @@ -133,9 +133,9 @@ struct XDripWidgetAttributes: ActivityAttributes { // quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed // show unitized zero deltas as +0 or +0.0 as per Nightscout format if (isMgDl) { - return (deltaChangeInMgDl > -1 && deltaChangeInMgDl < 1) ? "+0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0) ? "+0" : (deltaSign + valueAsString) } else { - return (deltaChangeInMgDl > -0.1 && deltaChangeInMgDl < 0.1) ? "+0.0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0.0) ? "+0.0" : (deltaSign + valueAsString) } } else { return isMgDl ? "-" : "-.-" diff --git a/xDrip Widget/XDripWidget+Entry.swift b/xDrip Widget/XDripWidget+Entry.swift index e97473278..fba679550 100644 --- a/xDrip Widget/XDripWidget+Entry.swift +++ b/xDrip Widget/XDripWidget+Entry.swift @@ -154,9 +154,9 @@ extension XDripWidget.Entry { // quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed // show unitized zero deltas as +0 or +0.0 as per Nightscout format if (isMgDl) { - return (deltaChangeInMgDl > -1 && deltaChangeInMgDl < 1) ? "+0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0) ? "+0" : (deltaSign + valueAsString) } else { - return (deltaChangeInMgDl > -0.1 && deltaChangeInMgDl < 0.1) ? "+0.0" : (deltaSign + valueAsString) + return (deltaChangeInMgDl == 0.0) ? "+0.0" : (deltaSign + valueAsString) } } else { return isMgDl ? "-" : "-.-" diff --git a/xdrip/Core Data/classes/BgReading+CoreDataClass.swift b/xdrip/Core Data/classes/BgReading+CoreDataClass.swift index 403cfd2c5..b0ef17eff 100644 --- a/xdrip/Core Data/classes/BgReading+CoreDataClass.swift +++ b/xdrip/Core Data/classes/BgReading+CoreDataClass.swift @@ -174,13 +174,13 @@ public class BgReading: NSManagedObject { // quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed // show unitized zero deltas as +0 or +0.0 as per Nightscout format if (mgdl) { - if (value > -1) && (value < 1) { + if (value == 0) { return "+0" + (showUnit ? (" " + Texts_Common.mgdl):""); } else { return deltaSign + valueAsString + (showUnit ? (" " + Texts_Common.mgdl):""); } } else { - if (value > -0.1) && (value < 0.1) { + if (value == 0.0) { return "+0.0" + (showUnit ? (" " + Texts_Common.mmol):""); } else { return deltaSign + valueAsString + (showUnit ? (" " + Texts_Common.mmol):"");