Skip to content

Commit

Permalink
Merge pull request nightscout#249 from kskandis/NightscoutCGMImportSe…
Browse files Browse the repository at this point in the history
…ttingsLoop

Remove unused Import Settings in JSON that cause errors decoding JSON
  • Loading branch information
dnzxy authored and mountrcg committed Jun 1, 2024
1 parent efd83ce commit 92cc1f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 1 addition & 5 deletions FreeAPS/Sources/Models/RawFetchedProfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ struct FetchedNightscoutProfileStore: JSON {
let _id: String
let defaultProfile: String
let startDate: String
let mills: Decimal
let enteredBy: String
let store: [String: ScheduledNightscoutProfile]
let created_at: String
let store: [String: FetchedNightscoutProfile]
}

struct FetchedNightscoutProfile: JSON {
let dia: Decimal
let carbs_hr: Int
let delay: Decimal
let timezone: String
let target_low: [NightscoutTimevalue]
let target_high: [NightscoutTimevalue]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ extension NightscoutConfig {
{
do {
let fetchedProfileStore = try jsonDecoder.decode([FetchedNightscoutProfileStore].self, from: data)
guard let fetchedProfile: ScheduledNightscoutProfile = fetchedProfileStore.first?.store["default"]
let loop = fetchedProfileStore.first?.enteredBy.contains("Loop")
guard let fetchedProfile: FetchedNightscoutProfile = fetchedProfileStore.first?
.store[loop! ? "Default" : "default"]
else {
error = "\nCan't find the default Nightscout Profile."
group.leave()
Expand Down

0 comments on commit 92cc1f6

Please sign in to comment.