From f5d2f739a9034f16a3bca3d11cbec214a7b7893a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Mar 2023 15:18:54 +0100 Subject: [PATCH] NSCv3: allow missing eventType --- .../main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt | 4 ++-- .../java/info/nightscout/sdk/remotemodel/RemoteTreatment.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt b/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt index 96b2f8905f..cb3edf420f 100644 --- a/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt +++ b/core/ns-sdk/src/main/java/info/nightscout/sdk/mapper/TreatmentMapper.kt @@ -45,7 +45,7 @@ internal fun RemoteTreatment.toTreatment(): NSTreatment? { subject = this.subject, isReadOnly = this.isReadOnly ?: false, isValid = this.isValid ?: true, - eventType = this.eventType, + eventType = this.eventType ?: EventType.MEAL_BOLUS, notes = this.notes, pumpId = this.pumpId, endId = this.endId, @@ -68,7 +68,7 @@ internal fun RemoteTreatment.toTreatment(): NSTreatment? { subject = this.subject, isReadOnly = this.isReadOnly ?: false, isValid = this.isValid ?: true, - eventType = this.eventType, + eventType = this.eventType ?: EventType.CARBS_CORRECTION, notes = this.notes, pumpId = this.pumpId, endId = this.endId, diff --git a/core/ns-sdk/src/main/java/info/nightscout/sdk/remotemodel/RemoteTreatment.kt b/core/ns-sdk/src/main/java/info/nightscout/sdk/remotemodel/RemoteTreatment.kt index 888110c41f..356a7acb6f 100644 --- a/core/ns-sdk/src/main/java/info/nightscout/sdk/remotemodel/RemoteTreatment.kt +++ b/core/ns-sdk/src/main/java/info/nightscout/sdk/remotemodel/RemoteTreatment.kt @@ -29,7 +29,7 @@ internal data class RemoteTreatment( @SerializedName("modifiedBy") val modifiedBy: String? = null, // string Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. @SerializedName("isValid") val isValid: Boolean? = null, // boolean A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) @SerializedName("isReadOnly") val isReadOnly: Boolean? = null, // boolean A flag set by client that locks the document from any changes. Every document marked with isReadOnly=true is forever immutable and cannot even be deleted. - @SerializedName("eventType") val eventType: EventType, // string "BG Check", "Snack Bolus", "Meal Bolus", "Correction Bolus", "Carb Correction", "Combo Bolus", "Announcement", "Note", "Question", "Exercise", "Site Change", "Sensor Start", "Sensor Change", "Pump Battery Change", "Insulin Change", "Temp Basal", "Profile Switch", "D.A.D. Alert", "Temporary Target", "OpenAPS Offline", "Bolus Wizard" + @SerializedName("eventType") val eventType: EventType?, // string "BG Check", "Snack Bolus", "Meal Bolus", "Correction Bolus", "Carb Correction", "Combo Bolus", "Announcement", "Note", "Question", "Exercise", "Site Change", "Sensor Start", "Sensor Change", "Pump Battery Change", "Insulin Change", "Temp Basal", "Profile Switch", "D.A.D. Alert", "Temporary Target", "OpenAPS Offline", "Bolus Wizard" @SerializedName("glucose") val glucose: Double? = null, // double Current glucose @SerializedName("glucoseType") val glucoseType: String? = null, // string example: "Sensor", "Finger", "Manual" @SerializedName("units") val units: String? = null, // string The units for the glucose value, mg/dl or mmol/l. It is strongly recommended to fill in this field.