Skip to content

Commit

Permalink
Release 1.6.1 (#41)
Browse files Browse the repository at this point in the history
Bug fixes and UI improvements/corrections.

1. Bug fix Sigmoid Formula. And disable the Dynamic ISF when autosens.min = autosens.max or when autosens.min > 1 (safety)  or when autosens.max < 1 (no use for DynISF in this case).

2. Make change of HbA1c unit persistent

3.  Fix for delete ("-") button in Add Cabs View.
Clears to "0" when deleted.

4. Statistics upload to NS fix. Add a default old Date value

5. UI fix for DecimalTextField. Display "" instead of 0 value when empty. 

7. Readme updates.
  • Loading branch information
Jon-b-m authored May 9, 2023
1 parent c6973de commit 3c11510
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
16 changes: 3 additions & 13 deletions FreeAPS/Sources/APS/APSManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -745,18 +745,14 @@ final class BaseAPSManager: APSManager, Injectable {
requestStats.fetchLimit = 1
try? stats = coredataContext.fetch(requestStats)
// Only save and upload once per day
guard (-1 * (stats.first?.lastrun ?? now).timeIntervalSinceNow.hours) > 22 else { return }
guard (-1 * (stats.first?.lastrun ?? .distantPast).timeIntervalSinceNow.hours) > 22 else { return }

let units = self.settingsManager.settings.units
let preferences = settingsManager.preferences

// MARK: Fetch Carbs from CoreData


var carbs = [Carbohydrates]()
var carbTotal: Decimal = 0

let requestCarbs = Carbohydrates.fetchRequest() as NSFetchRequest<Carbohydrates>

let daysAgo = Date().addingTimeInterval(-1.days.timeInterval)
requestCarbs.predicate = NSPredicate(format: "carbs > 0 AND date > %@", daysAgo as NSDate)

Expand Down Expand Up @@ -1335,13 +1331,7 @@ final class BaseAPSManager: APSManager, Injectable {
)
)

storage.transaction { storage in
storage.append(dailystat, to: file, uniqBy: \.created_at)
let uniqeEvents: [Statistics] = storage.retrieve(file, as: [Statistics].self)?
.filter { $0.created_at.addingTimeInterval(24.hours.timeInterval) > Date() }
.sorted { $0.created_at > $1.created_at } ?? []
storage.save(Array(uniqeEvents), as: file)
}
storage.save(dailystat, as: file)
nightscout.uploadStatistics(dailystat: dailystat)
nightscout.uploadPreferences()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension StatConfig {
Toggle("Allow Upload of Statistics to NS", isOn: $state.uploadStats)
Toggle("Display Chart X - Grid lines", isOn: $state.xGridLines)
Toggle("Display Chart Y - Grid lines", isOn: $state.yGridLines)
Toggle("Display Chart Threshold lines for Low and High)", isOn: $state.rulerMarks)
Toggle("Display Chart Threshold lines for Low and High", isOn: $state.rulerMarks)
Toggle("Standing / Laying TIR Chart", isOn: $state.oneDimensionalGraph)

HStack {
Expand Down
4 changes: 3 additions & 1 deletion FreeAPS/Sources/Views/DecimalTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ struct DecimalTextField: UIViewRepresentable {
let coordinator = context.coordinator
if coordinator.isEditing {
coordinator.resetEditing()
} else /* if value != 0 */ {
} else if value == 0 {
textField.text = ""
} else {
textField.text = formatter.string(for: value)
}
}
Expand Down

0 comments on commit 3c11510

Please sign in to comment.