From 2c5725717cd817f1555f6ba57a6260ddba3904e9 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 25 Mar 2021 03:25:57 +0100 Subject: [PATCH] remove test file --- .../database/entities/XXXValueWithUnit.kt | 39 +---- .../androidaps/plugins/pump/medtronic/test.kt | 144 ------------------ 2 files changed, 4 insertions(+), 179 deletions(-) delete mode 100644 medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/test.kt diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt index 477c940cb1..dbbd06f586 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/XXXValueWithUnit.kt @@ -46,7 +46,8 @@ sealed class XXXValueWithUnit { } } -fun List.toPresentationString(translator: Translator) = concat +fun List.toPresentationString(translator: Translator) = + joinToString(separator = " ") { it.toPresentationString(translator) } // TODO Move to destination module, then uncomment fun XXXValueWithUnit.toPresentationString(translator: Translator) : String = when(this){ @@ -90,49 +91,17 @@ fun XXXValueWithUnit.toPresentationString(translator: Translator) : String = whe * [x] new sealed classes * [x] use entry type directly, not String * [ ] database - * [ ] generate presentation string + * [x] generate presentation string * [ ] update fragment * [ ] generate csv * */ -// just do develop here +// just do develop in this file. Remove when done. interface Translator { - fun translate(action: UserEntry.Action): String fun translate(units: UserEntry.Units): String fun translate(meterType: TherapyEvent.MeterType): String fun translate(type: TherapyEvent.Type): String fun translate(reason: TemporaryTarget.Reason): String } - -/* -var valuesWithUnitString = "" -var rStringParam = 0 -val separator = " " -for(v in current.values) { - if (rStringParam >0) - rStringParam-- - else - when (v.unit) { - UserEntry.Units.Timestamp -> valuesWithUnitString += dateUtil.dateAndTimeAndSecondsString(v.lValue) + separator - UserEntry.Units.TherapyEvent -> valuesWithUnitString += translator.translate(v.sValue) + separator - UserEntry.Units.R_String -> { - rStringParam = v.lValue.toInt() - when (rStringParam) { // - 0 -> valuesWithUnitString += resourceHelper.gs(v.iValue) + separator - 1 -> valuesWithUnitString += resourceHelper.gs(v.iValue, current.values[current.values.indexOf(v)+1].value()) + separator - 2 -> valuesWithUnitString += resourceHelper.gs(v.iValue, current.values[current.values.indexOf(v)+1].value(), current.values[current.values.indexOf(v)+2].value()) + separator - 3 -> valuesWithUnitString += resourceHelper.gs(v.iValue, current.values[current.values.indexOf(v)+1].value(), current.values[current.values.indexOf(v)+2].value(), current.values[current.values.indexOf(v)+3].value()) + separator - 4 -> rStringParam = 0 - } - } - UserEntry.Units.Mg_Dl -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue) + translator.translate(UserEntry.Units.Mg_Dl) + separator else DecimalFormatter.to1Decimal(v.dValue/Constants.MMOLL_TO_MGDL) + translator.translate(UserEntry.Units.Mmol_L) + separator - UserEntry.Units.Mmol_L -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue*Constants.MMOLL_TO_MGDL) + translator.translate(UserEntry.Units.Mg_Dl) + separator else DecimalFormatter.to1Decimal(v.dValue) + translator.translate(UserEntry.Units.Mmol_L) + separator - UserEntry.Units.U_H, UserEntry.Units.U - -> valuesWithUnitString += DecimalFormatter.to2Decimal(v.dValue) + translator.translate(v.unit) + separator - UserEntry.Units.G, UserEntry.Units.M, UserEntry.Units.H, UserEntry.Units.Percent - -> valuesWithUnitString += v.iValue.toString() + translator.translate(v.unit) + separator - else -> valuesWithUnitString += if (v.iValue != 0 || v.sValue != "") { v.value().toString() + separator } else "" - } -}*/ diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/test.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/test.kt deleted file mode 100644 index 76df7928b8..0000000000 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/test.kt +++ /dev/null @@ -1,144 +0,0 @@ -import com.google.gson.annotations.SerializedName -import info.nightscout.androidaps.database.entities.GlucoseValue - -enum class SourceSensorDomain(val text : String) { - @SerializedName("AndroidAPS-Dexcom") - DEXCOM_NATIVE_UNKNOWN("AndroidAPS-Dexcom"), - @SerializedName("AndroidAPS-DexcomG6") - DEXCOM_G6_NATIVE("AndroidAPS-DexcomG6"), - @SerializedName("AndroidAPS-DexcomG5") - DEXCOM_G5_NATIVE("AndroidAPS-DexcomG5"), - @SerializedName("Bluetooth Wixel") - DEXCOM_G4_WIXEL("Bluetooth Wixel"), - @SerializedName("xBridge Wixel") - DEXCOM_G4_XBRIDGE("xBridge Wixel"), - @SerializedName("G4 Share Receiver") - DEXCOM_G4_NATIVE("G4 Share Receiver"), - @SerializedName("Medtrum A6") - MEDTRUM_A6("Medtrum A6"), - @SerializedName("Network G4") - DEXCOM_G4_NET("Network G4"), - @SerializedName("Network G4 and xBridge") - DEXCOM_G4_NET_XBRIDGE("Network G4 and xBridge"), - @SerializedName("Network G4 and Classic xDrip") - DEXCOM_G4_NET_CLASSIC("Network G4 and Classic xDrip"), - @SerializedName("DexcomG5") - DEXCOM_G5_XDRIP("DexcomG5"), - @SerializedName("G6 Native") - DEXCOM_G6_NATIVE_XDRIP("G6 Native"), - @SerializedName("G5 Native") - DEXCOM_G5_NATIVE_XDRIP("G5 Native"), - @SerializedName("G6 Native / G5 Native") - DEXCOM_G6_G5_NATIVE_XDRIP("G6 Native / G5 Native"), - @SerializedName("Network libre") - LIBRE_1_NET("Network libre"), - @SerializedName("BlueReader") - LIBRE_1_BLUE("BlueReader"), - @SerializedName("Transmiter PL") - LIBRE_1_PL("Transmiter PL"), - @SerializedName("Blucon") - LIBRE_1_BLUCON("Blucon"), - @SerializedName("Tomato") - LIBRE_1_TOMATO("Tomato"), - @SerializedName("Rfduino") - LIBRE_1_RF("Rfduino"), - @SerializedName("LimiTTer") - LIBRE_1_LIMITTER("LimiTTer"), - @SerializedName("Glimp") - GLIMP("Glimp"), - @SerializedName("Libre2") - LIBRE_2_NATIVE("Libre2"), - @SerializedName("Poctech") - POCTECH_NATIVE("Poctech"), - @SerializedName("MM600Series") - MM_600_SERIES("MM600Series"), - @SerializedName("Eversense") - EVERSENSE("Eversense"), - @SerializedName("Random") - RANDOM("Random"), - @SerializedName("Unknown") - UNKNOWN("Unknown"), - - @SerializedName("IOBPrediction") - IOB_PREDICTION("IOBPrediction"), - @SerializedName("aCOBPrediction") - aCOB_PREDICTION("aCOBPrediction"), - @SerializedName("COBPrediction") - COB_PREDICTION("COBPrediction"), - @SerializedName("UAMPrediction") - UAM_PREDICTION("UAMPrediction"), - @SerializedName("ZTPrediction") - ZT_PREDICTION("ZTPrediction") -} - -fun GlucoseValue.SourceSensor.toDomain(): SourceSensorDomain = when(this) { - GlucoseValue.SourceSensor.DEXCOM_NATIVE_UNKNOWN -> SourceSensorDomain.DEXCOM_NATIVE_UNKNOWN - GlucoseValue.SourceSensor.DEXCOM_G6_NATIVE -> SourceSensorDomain.DEXCOM_G6_NATIVE - GlucoseValue.SourceSensor.DEXCOM_G5_NATIVE -> SourceSensorDomain.DEXCOM_G5_NATIVE - GlucoseValue.SourceSensor.DEXCOM_G4_WIXEL -> SourceSensorDomain.DEXCOM_G4_WIXEL - GlucoseValue.SourceSensor.DEXCOM_G4_XBRIDGE -> SourceSensorDomain.DEXCOM_G4_XBRIDGE - GlucoseValue.SourceSensor.DEXCOM_G4_NATIVE -> SourceSensorDomain.DEXCOM_G4_NATIVE - GlucoseValue.SourceSensor.MEDTRUM_A6 -> SourceSensorDomain.MEDTRUM_A6 - GlucoseValue.SourceSensor.DEXCOM_G4_NET -> SourceSensorDomain.DEXCOM_G4_NET - GlucoseValue.SourceSensor.DEXCOM_G4_NET_XBRIDGE -> SourceSensorDomain.DEXCOM_G4_NET_XBRIDGE - GlucoseValue.SourceSensor.DEXCOM_G4_NET_CLASSIC -> SourceSensorDomain.DEXCOM_G4_NET_CLASSIC - GlucoseValue.SourceSensor.DEXCOM_G5_XDRIP -> SourceSensorDomain.DEXCOM_G5_XDRIP - GlucoseValue.SourceSensor.DEXCOM_G6_NATIVE_XDRIP -> SourceSensorDomain.DEXCOM_G6_NATIVE_XDRIP - GlucoseValue.SourceSensor.DEXCOM_G5_NATIVE_XDRIP -> SourceSensorDomain.DEXCOM_G5_NATIVE_XDRIP - GlucoseValue.SourceSensor.DEXCOM_G6_G5_NATIVE_XDRIP -> SourceSensorDomain.DEXCOM_G6_G5_NATIVE_XDRIP - GlucoseValue.SourceSensor.LIBRE_1_NET -> SourceSensorDomain.LIBRE_1_NET - GlucoseValue.SourceSensor.LIBRE_1_BLUE -> SourceSensorDomain.LIBRE_1_BLUE - GlucoseValue.SourceSensor.LIBRE_1_PL -> SourceSensorDomain.LIBRE_1_PL - GlucoseValue.SourceSensor.LIBRE_1_BLUCON -> SourceSensorDomain.LIBRE_1_BLUCON - GlucoseValue.SourceSensor.LIBRE_1_TOMATO -> SourceSensorDomain.LIBRE_1_TOMATO - GlucoseValue.SourceSensor.LIBRE_1_RF -> SourceSensorDomain.LIBRE_1_LIMITTER - GlucoseValue.SourceSensor.LIBRE_1_LIMITTER -> SourceSensorDomain.LIBRE_1_LIMITTER - GlucoseValue.SourceSensor.GLIMP -> SourceSensorDomain.GLIMP - GlucoseValue.SourceSensor.LIBRE_2_NATIVE -> SourceSensorDomain.LIBRE_2_NATIVE - GlucoseValue.SourceSensor.POCTECH_NATIVE -> SourceSensorDomain.POCTECH_NATIVE - GlucoseValue.SourceSensor.MM_600_SERIES -> SourceSensorDomain.MM_600_SERIES - GlucoseValue.SourceSensor.EVERSENSE -> SourceSensorDomain.EVERSENSE - GlucoseValue.SourceSensor.RANDOM -> SourceSensorDomain.RANDOM - GlucoseValue.SourceSensor.UNKNOWN -> SourceSensorDomain.UNKNOWN - GlucoseValue.SourceSensor.IOB_PREDICTION -> SourceSensorDomain.IOB_PREDICTION - GlucoseValue.SourceSensor.aCOB_PREDICTION -> SourceSensorDomain.aCOB_PREDICTION - GlucoseValue.SourceSensor.COB_PREDICTION -> SourceSensorDomain.COB_PREDICTION - GlucoseValue.SourceSensor.UAM_PREDICTION -> SourceSensorDomain.UAM_PREDICTION - GlucoseValue.SourceSensor.ZT_PREDICTION -> SourceSensorDomain.ZT_PREDICTION -} - -fun SourceSensorDomain.toPersistence(): GlucoseValue.SourceSensor = when(this) { - SourceSensorDomain.DEXCOM_NATIVE_UNKNOWN -> GlucoseValue.SourceSensor.DEXCOM_NATIVE_UNKNOWN - SourceSensorDomain.DEXCOM_G6_NATIVE -> GlucoseValue.SourceSensor.DEXCOM_G6_NATIVE - SourceSensorDomain.DEXCOM_G5_NATIVE -> GlucoseValue.SourceSensor.DEXCOM_G5_NATIVE - SourceSensorDomain.DEXCOM_G4_WIXEL -> GlucoseValue.SourceSensor.DEXCOM_G4_WIXEL - SourceSensorDomain.DEXCOM_G4_XBRIDGE -> GlucoseValue.SourceSensor.DEXCOM_G4_XBRIDGE - SourceSensorDomain.DEXCOM_G4_NATIVE -> GlucoseValue.SourceSensor.DEXCOM_G4_NATIVE - SourceSensorDomain.MEDTRUM_A6 -> GlucoseValue.SourceSensor.MEDTRUM_A6 - SourceSensorDomain.DEXCOM_G4_NET -> GlucoseValue.SourceSensor.DEXCOM_G4_NET - SourceSensorDomain.DEXCOM_G4_NET_XBRIDGE -> GlucoseValue.SourceSensor.DEXCOM_G4_NET_XBRIDGE - SourceSensorDomain.DEXCOM_G4_NET_CLASSIC -> GlucoseValue.SourceSensor.DEXCOM_G4_NET_CLASSIC - SourceSensorDomain.DEXCOM_G5_XDRIP -> GlucoseValue.SourceSensor.DEXCOM_G5_XDRIP - SourceSensorDomain.DEXCOM_G6_NATIVE_XDRIP -> GlucoseValue.SourceSensor.DEXCOM_G6_NATIVE_XDRIP - SourceSensorDomain.DEXCOM_G5_NATIVE_XDRIP -> GlucoseValue.SourceSensor.DEXCOM_G5_NATIVE_XDRIP - SourceSensorDomain.DEXCOM_G6_G5_NATIVE_XDRIP -> GlucoseValue.SourceSensor.DEXCOM_G6_G5_NATIVE_XDRIP - SourceSensorDomain.LIBRE_1_NET -> GlucoseValue.SourceSensor.LIBRE_1_NET - SourceSensorDomain.LIBRE_1_BLUE -> GlucoseValue.SourceSensor.LIBRE_1_BLUE - SourceSensorDomain.LIBRE_1_PL -> GlucoseValue.SourceSensor.LIBRE_1_PL - SourceSensorDomain.LIBRE_1_BLUCON -> GlucoseValue.SourceSensor.LIBRE_1_BLUCON - SourceSensorDomain.LIBRE_1_TOMATO -> GlucoseValue.SourceSensor.LIBRE_1_TOMATO - SourceSensorDomain.LIBRE_1_RF -> GlucoseValue.SourceSensor.LIBRE_1_LIMITTER - SourceSensorDomain.LIBRE_1_LIMITTER -> GlucoseValue.SourceSensor.LIBRE_1_LIMITTER - SourceSensorDomain.GLIMP -> GlucoseValue.SourceSensor.GLIMP - SourceSensorDomain.LIBRE_2_NATIVE -> GlucoseValue.SourceSensor.LIBRE_2_NATIVE - SourceSensorDomain.POCTECH_NATIVE -> GlucoseValue.SourceSensor.POCTECH_NATIVE - SourceSensorDomain.MM_600_SERIES -> GlucoseValue.SourceSensor.MM_600_SERIES - SourceSensorDomain.EVERSENSE -> GlucoseValue.SourceSensor.EVERSENSE - SourceSensorDomain.RANDOM -> GlucoseValue.SourceSensor.RANDOM - SourceSensorDomain.UNKNOWN -> GlucoseValue.SourceSensor.UNKNOWN - SourceSensorDomain.IOB_PREDICTION -> GlucoseValue.SourceSensor.IOB_PREDICTION - SourceSensorDomain.aCOB_PREDICTION -> GlucoseValue.SourceSensor.aCOB_PREDICTION - SourceSensorDomain.COB_PREDICTION -> GlucoseValue.SourceSensor.COB_PREDICTION - SourceSensorDomain.UAM_PREDICTION -> GlucoseValue.SourceSensor.UAM_PREDICTION - SourceSensorDomain.ZT_PREDICTION -> GlucoseValue.SourceSensor.ZT_PREDICTION -} \ No newline at end of file