Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused Import Settings in JSON that cause errors decoding JSON #249

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
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
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