Skip to content

Commit

Permalink
Release 5.2.2 (#894)
Browse files Browse the repository at this point in the history
Resolve issue 890: #890
Resolve a nasty typo preventing some ISF overrides.
Add additional check for missing TIR data to prevent any eventual out of bounds errors.
Add some more logging of overrides.
German Crowdin updates
  • Loading branch information
Jon-b-m authored Oct 4, 2024
1 parent bd25efe commit 07ce9f0
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_DISPLAY_NAME = iAPS
APP_VERSION = 5.2.1
APP_VERSION = 5.2.2
APP_BUILD_NUMBER = 1
COPYRIGHT_NOTICE =
DEVELOPER_TEAM = ##TEAM_ID##
Expand Down
18 changes: 14 additions & 4 deletions FreeAPS/Resources/javascript/prepare/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,23 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu
profile.current_basal *= factor;
// ISF and CR
if (dynamicVariables.isfAndCr) {
profile.sense /= factor;
profile.sens /= factor;
profile.carb_ratio = round(profile.carb_ratio / factor, 1);
console.log("Override Active, " + dynamicVariables.overridePercentage + "%");
} else {
if (dynamicVariables.cr) { profile.carb_ratio = round(profile.carb_ratio / factor, 1); }
if (dynamicVariables.isf) { profile.sens /= factor; }
if (dynamicVariables.cr) {
profile.carb_ratio = round(profile.carb_ratio / factor, 1);
console.log("Override Active, CR: " + profile.old_cr + " → " + profile.carb_ratio);
}
if (dynamicVariables.isf) {
profile.sens /= factor;
if (profile.out_units == 'mmol/L') {
console.log("Override Active, ISF: " + profile.old_isf + " → " + Math.round(profile.sens * 0.0555 * 10) / 10);
} else {
console.log("Override Active, ISF: " + profile.old_isf + " → " + profile.sens);
}
}
}
console.log("Override Active, " + dynamicVariables.overridePercentage + "%");
}
// SMB Minutes
if (dynamicVariables.advancedSettings && dynamicVariables.smbMinutes !== profile.maxSMBBasalMinutes) {
Expand Down
9 changes: 4 additions & 5 deletions FreeAPS/Resources/javascript/prepare/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu
profile.tdd_factor = adjusted;
}
}


profile.old_cr = profile.carb_ratio;
profile.old_isf = profile.sens;
if (profile.out_units == 'mmol/L') {
profile.old_isf = Math.round(profile.sens * 0.0555 * 10) / 10;
} else {
profile.old_isf = profile.sens;
}
profile.old_cr = profile.carb_ratio;


if (profile.useNewFormula && profile.temptargetSet && (profile.high_temptarget_raises_sensitivity || profile.exercise_mode || dynamicVariables.isEnabled) && profile.min_bg >= 118) {
profile.useNewFormula = false;
console.log("Dynamic ISF disabled due to an active exercise ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"Suggested at" = "Vorgeschlagen um";

/* Headline in enacted pop up (at: at what time) */
"Status at" = "Status at";
"Status at" = "Status vom";

/* Bolus View Meal Summary Header */
"Meal Summary" = "Mahlzeitenübersicht";
Expand Down Expand Up @@ -642,7 +642,7 @@ Enact a temp Basal or a temp target */
"Treatments" = "Behandlungen";

/* Hypo Treatment Preset */
"Treatment" = "Treatment";
"Treatment" = "Behandlung";

/* " min" in Treatments list */
" min" = " Min";
Expand Down Expand Up @@ -1252,7 +1252,7 @@ Enact a temp Basal or a temp target */
"Can't enact the new loop cycle recommendation, because a Bolus is in progress. Wait for next loop cycle" = "Die neue Empfehlung kann nicht angewendet werden, da zurzeit ein Bolus verabreicht wird. Warten Sie bitte die nächste Schleife ab.";

/* Pump Error */
"Pump is Busy." = "Pump is Busy.";
"Pump is Busy." = "Die Insulinpumpe ist beschäftigt.";

/* -------------- Developer settings ---------------------- */
/* Debug options */
Expand Down
110 changes: 56 additions & 54 deletions FreeAPS/Sources/Modules/Home/View/Previews/TIRView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,64 +17,66 @@ struct PreviewChart: View {
}

var body: some View {
VStack {
let padding: CGFloat = 40
// Prepare the chart data
let data = prepareData()
HStack {
Text("Today")
}.padding(.bottom, 15).font(.previewHeadline)
if !readings.isEmpty {
VStack {
let padding: CGFloat = 40
// Prepare the chart data
let data = prepareData()
HStack {
Text("Today")
}.padding(.bottom, 15).font(.previewHeadline)

HStack {
Chart(data) { item in
BarMark(
x: .value("TIR", item.type),
y: .value("Percentage", item.percentage),
width: .fixed(65)
)
.foregroundStyle(by: .value("Group", item.group))
.clipShape(
UnevenRoundedRectangle(
topLeadingRadius: (item.last || item.percentage == 100) ? 4 : 0,
bottomLeadingRadius: (item.first || item.percentage == 100) ? 4 : 0,
bottomTrailingRadius: (item.first || item.percentage == 100) ? 4 : 0,
topTrailingRadius: (item.last || item.percentage == 100) ? 4 : 0
HStack {
Chart(data) { item in
BarMark(
x: .value("TIR", item.type),
y: .value("Percentage", item.percentage),
width: .fixed(65)
)
)
}
.chartForegroundStyleScale([
NSLocalizedString(
"Low",
comment: ""
): .red,
NSLocalizedString("In Range", comment: ""): .darkGreen,
NSLocalizedString(
"High",
comment: ""
): .yellow,
NSLocalizedString(
"Very High",
comment: ""
): .red,
NSLocalizedString(
"Very Low",
comment: ""
): .darkRed,
"Separator": colorScheme == .dark ? .black : .white
])
.chartXAxis(.hidden)
.chartYAxis(.hidden)
.chartLegend(.hidden)
.padding(.bottom, 15)
.padding(.leading, padding)
.frame(maxWidth: (UIScreen.main.bounds.width / 5) + padding)
.foregroundStyle(by: .value("Group", item.group))
.clipShape(
UnevenRoundedRectangle(
topLeadingRadius: (item.last || item.percentage == 100) ? 4 : 0,
bottomLeadingRadius: (item.first || item.percentage == 100) ? 4 : 0,
bottomTrailingRadius: (item.first || item.percentage == 100) ? 4 : 0,
topTrailingRadius: (item.last || item.percentage == 100) ? 4 : 0
)
)
}
.chartForegroundStyleScale([
NSLocalizedString(
"Low",
comment: ""
): .red,
NSLocalizedString("In Range", comment: ""): .darkGreen,
NSLocalizedString(
"High",
comment: ""
): .yellow,
NSLocalizedString(
"Very High",
comment: ""
): .red,
NSLocalizedString(
"Very Low",
comment: ""
): .darkRed,
"Separator": colorScheme == .dark ? .black : .white
])
.chartXAxis(.hidden)
.chartYAxis(.hidden)
.chartLegend(.hidden)
.padding(.bottom, 15)
.padding(.leading, padding)
.frame(maxWidth: (UIScreen.main.bounds.width / 5) + padding)

sumView(data).offset(x: 0, y: -7)
}
sumView(data).offset(x: 0, y: -7)
}

}.frame(maxHeight: 180)
.padding(.top, 20)
.dynamicTypeSize(...DynamicTypeSize.xLarge)
}.frame(maxHeight: 180)
.padding(.top, 20)
.dynamicTypeSize(...DynamicTypeSize.xLarge)
}
}

@ViewBuilder private func sumView(_ data: [TIRinPercent]) -> some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ extension OverrideProfilesConfig {
} else { saveOverride.target = 6 }
if advancedSettings {
saveOverride.advancedSettings = true
saveOverride.isfAndCr = isfAndCr
if !isfAndCr {
saveOverride.isfAndCr = false
saveOverride.isf = isf
saveOverride.cr = cr
} else { saveOverride.isfAndCr = true }
}
if smbIsAlwaysOff {
saveOverride.smbIsAlwaysOff = true
saveOverride.start = start as NSDecimalNumber
Expand Down Expand Up @@ -128,23 +128,23 @@ extension OverrideProfilesConfig {
) as NSDecimalNumber
} else { saveOverride.target = 6 }

if advancedSettings {
if self.advancedSettings {
saveOverride.advancedSettings = true
saveOverride.isfAndCr = self.isfAndCr
if !isfAndCr {
saveOverride.isfAndCr = false
saveOverride.isf = isf
saveOverride.cr = cr
} else { saveOverride.isfAndCr = true }
saveOverride.isf = self.isf
saveOverride.cr = self.cr
}
if smbIsAlwaysOff {
saveOverride.smbIsAlwaysOff = true
saveOverride.start = start as NSDecimalNumber
saveOverride.end = end as NSDecimalNumber
} else { smbIsAlwaysOff = false }

saveOverride.smbMinutes = smbMinutes as NSDecimalNumber
saveOverride.uamMinutes = uamMinutes as NSDecimalNumber
saveOverride.smbMinutes = self.smbMinutes as NSDecimalNumber
saveOverride.uamMinutes = self.uamMinutes as NSDecimalNumber
saveOverride.maxIOB = maxIOB as NSDecimalNumber
saveOverride.overrideMaxIOB = overrideMaxIOB
saveOverride.overrideMaxIOB = self.overrideMaxIOB
}
try? self.coredataContext.save()
}
Expand Down Expand Up @@ -177,6 +177,8 @@ extension OverrideProfilesConfig {
saveOverride.isPreset = true
saveOverride.date = Date()
saveOverride.id = id_
saveOverride.advancedSettings = profile.advancedSettings
saveOverride.isfAndCr = profile.isfAndCr

if let tar = profile.target, tar == 0 {
saveOverride.target = 6
Expand All @@ -185,12 +187,10 @@ extension OverrideProfilesConfig {
}

if profile.advancedSettings {
saveOverride.advancedSettings = true
if !isfAndCr {
saveOverride.isfAndCr = false
if !profile.isfAndCr {
saveOverride.isf = profile.isf
saveOverride.cr = profile.cr
} else { saveOverride.isfAndCr = true }
}
if profile.smbIsAlwaysOff {
saveOverride.smbIsAlwaysOff = true
saveOverride.start = profile.start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,10 @@ extension OverrideProfilesConfig {
}
}
.dynamicTypeSize(...DynamicTypeSize.xxLarge)
.onAppear(perform: configureView)
.onAppear { state.savedSettings() }
.onAppear {
configureView()
state.savedSettings()
}
.navigationBarTitle("Profiles")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing: Button("Close", action: state.hideModal))
Expand Down

0 comments on commit 07ce9f0

Please sign in to comment.