|
|
@@ -66,8 +66,9 @@ enum DataTable {
|
|
|
let isFPU: Bool?
|
|
|
let fpuID: String?
|
|
|
let note: String?
|
|
|
+ let isNonPump: Bool?
|
|
|
|
|
|
- private var numberFormater: NumberFormatter {
|
|
|
+ private var numberFormatter: NumberFormatter {
|
|
|
let formatter = NumberFormatter()
|
|
|
formatter.numberStyle = .decimal
|
|
|
formatter.maximumFractionDigits = 2
|
|
|
@@ -92,7 +93,8 @@ enum DataTable {
|
|
|
idPumpEvent: String? = nil,
|
|
|
isFPU: Bool? = false,
|
|
|
fpuID: String? = nil,
|
|
|
- note: String? = nil
|
|
|
+ note: String? = nil,
|
|
|
+ isNonPump: Bool? = nil
|
|
|
) {
|
|
|
self.units = units
|
|
|
self.type = type
|
|
|
@@ -105,6 +107,7 @@ enum DataTable {
|
|
|
self.isFPU = isFPU
|
|
|
self.fpuID = fpuID
|
|
|
self.note = note
|
|
|
+ self.isNonPump = isNonPump
|
|
|
}
|
|
|
|
|
|
static func == (lhs: Treatment, rhs: Treatment) -> Bool {
|
|
|
@@ -126,14 +129,21 @@ enum DataTable {
|
|
|
|
|
|
switch type {
|
|
|
case .carbs:
|
|
|
- return numberFormater.string(from: amount as NSNumber)! + NSLocalizedString(" g", comment: "gram of carbs")
|
|
|
+ return numberFormatter.string(from: amount as NSNumber)! + NSLocalizedString(" g", comment: "gram of carbs")
|
|
|
case .fpus:
|
|
|
- return numberFormater
|
|
|
+ return numberFormatter
|
|
|
.string(from: amount as NSNumber)! + NSLocalizedString(" g", comment: "gram of carb equilvalents")
|
|
|
case .bolus:
|
|
|
- return numberFormater.string(from: amount as NSNumber)! + NSLocalizedString(" U", comment: "Insulin unit")
|
|
|
+ var bolusText = ""
|
|
|
+
|
|
|
+ if isNonPump ?? false {
|
|
|
+ bolusText += " " + NSLocalizedString("Non-Pump", comment: "Non-pump Insulin")
|
|
|
+ }
|
|
|
+
|
|
|
+ return numberFormatter
|
|
|
+ .string(from: amount as NSNumber)! + NSLocalizedString(" U", comment: "Insulin unit") + bolusText
|
|
|
case .tempBasal:
|
|
|
- return numberFormater
|
|
|
+ return numberFormatter
|
|
|
.string(from: amount as NSNumber)! + NSLocalizedString(" U/hr", comment: "Unit insulin per hour")
|
|
|
case .tempTarget:
|
|
|
var converted = amount
|
|
|
@@ -142,7 +152,7 @@ enum DataTable {
|
|
|
}
|
|
|
|
|
|
guard var secondAmount = secondAmount else {
|
|
|
- return numberFormater.string(from: converted as NSNumber)! + " \(units.rawValue)"
|
|
|
+ return numberFormatter.string(from: converted as NSNumber)! + " \(units.rawValue)"
|
|
|
}
|
|
|
if units == .mmolL {
|
|
|
secondAmount = secondAmount.asMmolL
|
|
|
@@ -177,7 +187,7 @@ enum DataTable {
|
|
|
guard let duration = duration, duration > 0 else {
|
|
|
return nil
|
|
|
}
|
|
|
- return numberFormater.string(from: duration as NSNumber)! + " min"
|
|
|
+ return numberFormatter.string(from: duration as NSNumber)! + " min"
|
|
|
}
|
|
|
}
|
|
|
|