Skip to content

Commit

Permalink
adding tracing in calibration upload to fix issue wiht one user
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanDegraeve committed Jul 29, 2020
1 parent 4300cdc commit 08f6937
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions xdrip/Managers/NightScout/NightScoutUploadManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ public class NightScoutUploadManager:NSObject {
// 2 records are uploaded to nightscout for each calibration: a cal record and a mbg record
let calibrationsDictionaryRepresentation = calibrationsToUpload.map({$0.dictionaryRepresentationForCalRecordNightScoutUpload}) + calibrationsToUpload.map({$0.dictionaryRepresentationForMbgRecordNightScoutUpload})

let traceValue = calibrationsDictionaryRepresentation.description
trace("tracevalue = %{public}@", log: oslog, category: ConstantsLog.categoryNightScoutUploadManager, type: .info, traceValue)

uploadData(dataToUpload: calibrationsDictionaryRepresentation, traceString: "uploadCalibrationsToNightScout", siteURL: siteURL, path: nightScoutEntriesPath, apiKey: apiKey, completionHandler: {

// change timeStampLatestNightScoutUploadedCalibration
Expand Down Expand Up @@ -296,6 +299,16 @@ public class NightScoutUploadManager:NSObject {
// transform dataToUpload to json
let dateToUploadAsJSON = try JSONSerialization.data(withJSONObject: dataToUpload, options: [])

if let dateToUploadAsJSONAsString = String(bytes: dateToUploadAsJSON, encoding: .utf8) {

trace("dateToUploadAsJSON = %{public}@", log: oslog, category: ConstantsLog.categoryNightScoutUploadManager, type: .info, dateToUploadAsJSONAsString)



} else {
trace("could not create dateToUploadAsJSON", log: oslog, category: ConstantsLog.categoryNightScoutUploadManager, type: .info)
}

if let url = URL(string: siteURL) {

// create upload url
Expand Down

0 comments on commit 08f6937

Please sign in to comment.