diff --git a/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryStrings.kt b/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryStrings.kt
index 7d53305be6..8da2ef3a3d 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryStrings.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryStrings.kt
@@ -98,7 +98,6 @@ fun UserEntry.Action.stringId(): Int {
this == UserEntry.Action.SMS_PUMP_DISCONNECT -> R.string.uel_sms_pump_disconnect
this == UserEntry.Action.SMS_SMS -> R.string.uel_sms_sms
this == UserEntry.Action.SMS_TT -> R.string.uel_sms_tt
- else -> R.string.uel_sms_tt
-
+ else -> R.string.uel_unknown
}
}
\ No newline at end of file
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index c53af0a267..21c17997ba 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -419,6 +419,7 @@
SMS PUMP DISCONNECT
SMS SMS
SMS TT
+ UNKNOWN
- %1$d day
diff --git a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
index cdac1563d5..5c054bd8be 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
@@ -10,6 +10,12 @@ import org.json.JSONObject
class Converters {
+ @TypeConverter
+ fun fromAction(action: UserEntry.Action?) = action?.name
+
+ @TypeConverter
+ fun toAction(action: String?) = action?.let { UserEntry.Action.valueOf(it) }
+
@TypeConverter
fun fromBolusType(bolusType: Bolus.Type?) = bolusType?.name
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
index ecc4e98c52..2ee5f03c7d 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
@@ -115,6 +115,12 @@ data class UserEntry(
@SerializedName("SMS_PUMP_CONNECT") SMS_PUMP_CONNECT,
@SerializedName("SMS_PUMP_DISCONNECT") SMS_PUMP_DISCONNECT,
@SerializedName("SMS_SMS") SMS_SMS,
- @SerializedName("SMS_TT") SMS_TT
+ @SerializedName("SMS_TT") SMS_TT,
+ @SerializedName("UNKNOWN") UNKNOWN
+ ;
+
+ companion object {
+ fun fromString(source: String?) = UserEntry.Action.values().firstOrNull { it.name == source } ?: UserEntry.Action.UNKNOWN
+ }
}
}
\ No newline at end of file