From bba7d7aae577fc413c371b20b5108b4bf1804811 Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:55:49 +0200 Subject: [PATCH] prevent insulin unit fractions from being deleted in some locales --- .../Treatments/TreatmentsInsertViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift b/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift index 05b9e56fe..6e7e37ea6 100644 --- a/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift +++ b/xdrip/View Controllers/Treatments/TreatmentsInsertViewController.swift @@ -138,7 +138,8 @@ class TreatmentsInsertViewController : UIViewController { // if no deletes treatMentEntryToUpdate let updateFunction = { (textField: UITextField) in - if let text = textField.text, let value = Double(text), value > 0 { + // the values are stored in coredate with a "." decimal point. We need to just ensure the decimal separator is a point and not a comma (which some locales use) + if let text = textField.text, let value = Double(text.replacingOccurrences(of: ",", with: ".")), value > 0 { // keep track if changed or not var treatMentEntryToUpdateChanged = false