Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion NightscoutServiceKit/Extensions/DoseEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ extension DoseEntry {
case .basal:
return nil
case .bolus:
// Non-automatic boluses may carry a finer origin (remote/watch/manual/shortcut), recorded by the
// app against the dose's syncIdentifier. Automatic boluses are already distinguished by `automatic`.
// `notes` carries the human-readable label so it shows in the Nightscout UI; `bolusOrigin` is the
// stable machine token.
let origin = syncIdentifier.flatMap { BolusOriginStore.shared.origin(forSyncIdentifier: $0) }
return BolusNightscoutTreatment(
timestamp: startDate,
enteredBy: source,
Expand All @@ -27,9 +32,11 @@ extension DoseEntry {
unabsorbed: 0, // The pump's reported IOB isn't relevant, nor stored
duration: duration,
automatic: automatic ?? false,
notes: origin?.displayName,
/* id: objectId, */ /// Specifying _id only works when doing a put (modify); all dose uploads are currently posting so they can be either create or update
syncIdentifier: syncIdentifier,
insulinType: insulinType?.brandName
insulinType: insulinType?.brandName,
bolusOrigin: origin?.rawValue
)
case .resume:
return nil
Expand Down