From 08f69376c9480e063839d667f5056a6dcb06b32e Mon Sep 17 00:00:00 2001 From: Johan Degraeve Date: Wed, 29 Jul 2020 19:06:22 +0200 Subject: [PATCH] adding tracing in calibration upload to fix issue wiht one user --- .../NightScout/NightScoutUploadManager.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xdrip/Managers/NightScout/NightScoutUploadManager.swift b/xdrip/Managers/NightScout/NightScoutUploadManager.swift index 9c920f3c1..26947218c 100644 --- a/xdrip/Managers/NightScout/NightScoutUploadManager.swift +++ b/xdrip/Managers/NightScout/NightScoutUploadManager.swift @@ -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 @@ -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