Merge pull request #516 from Philoul/UserEntryImprovement

User entry improvement
This commit is contained in:
Milos Kozak 2021-05-13 17:47:08 +02:00 committed by GitHub
commit feb37888d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 20 deletions

View file

@ -152,7 +152,7 @@ class UserEntryPresentationHelper @Inject constructor(
csvString(R.string.eventtype),
csvString(R.string.ue_source),
csvString(R.string.careportal_note),
csvString(R.string.ue_formated_string),
csvString(R.string.ue_string),
csvString(R.string.event_time_label),
csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol),
csvString(R.string.shortgram),
@ -165,15 +165,15 @@ class UserEntryPresentationHelper @Inject constructor(
) + "\n"
private fun getCsvEntry(entry: UserEntry): String {
val fullvalueWithUnitList = ArrayList<ValueWithUnit?>(entry.values)
var timestampRec = "" + entry.timestamp
var dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
var utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt())
var action = csvString(entry.action)
val fullvalueWithUnitList = ArrayList(entry.values)
val timestampRec = entry.timestamp.toString()
val dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
val utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt())
val action = csvString(entry.action)
var therapyEvent = ""
var source = translator.translate(entry.source)
var note = csvString(entry.note)
var stringResource = ""
val source = translator.translate(entry.source)
val note = csvString(entry.note)
var simpleString = ""
var timestamp = ""
var bg = ""
var gram = ""
@ -182,7 +182,7 @@ class UserEntryPresentationHelper @Inject constructor(
var percent = ""
var hour = ""
var minute = ""
var other = ""
var noUnit = ""
for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) {
when (valueWithUnit) {
@ -192,8 +192,8 @@ class UserEntryPresentationHelper @Inject constructor(
is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
is ValueWithUnit.SimpleInt -> other = other.addWithSeparator(valueWithUnit.value)
is ValueWithUnit.SimpleString -> other = other.addWithSeparator(valueWithUnit.value)
is ValueWithUnit.SimpleInt -> noUnit = noUnit.addWithSeparator(valueWithUnit.value)
is ValueWithUnit.SimpleString -> simpleString = simpleString.addWithSeparator(valueWithUnit.value)
is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
is ValueWithUnit.TherapyEventTTReason -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
is ValueWithUnit.TherapyEventType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
@ -210,9 +210,9 @@ class UserEntryPresentationHelper @Inject constructor(
}
therapyEvent = csvString(therapyEvent)
stringResource = csvString(stringResource)
other = csvString(other)
return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$stringResource;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$other"
simpleString = csvString(simpleString)
noUnit = csvString(noUnit)
return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$simpleString;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$noUnit"
}
private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"").replace("\n"," / ") + "\""

View file

@ -413,7 +413,7 @@
<string name="uel_carbs">CARBS</string>
<string name="uel_extended_carbs">EXTENDED CARBS</string>
<string name="uel_temp_basal">TEMP BASAL</string>
<string name="uel_tt">TT</string>
<string name="uel_tt">TEMP TARGET</string>
<string name="uel_new_profile">NEW PROFILE</string>
<string name="uel_clone_profile">CLONE PROFILE</string>
<string name="uel_store_profile">STORE PROFILE</string>
@ -434,7 +434,7 @@
<string name="uel_cancel_temp_basal">CANCEL TEMP BASAL</string>
<string name="uel_cancel_bolus">CANCEL BOLUS</string>
<string name="uel_cancel_extended_bolus">CANCEL EXTENDED BOLUS</string>
<string name="uel_cancel_tt">CANCEL TT</string>
<string name="uel_cancel_tt">CANCEL TEMP TARGET</string>
<string name="uel_careportal">CAREPORTAL</string>
<string name="uel_site_change">SITE CHANGE</string>
<string name="uel_reservoir_change">RESERVOIR CHANGE</string>
@ -444,7 +444,7 @@
<string name="uel_careportal_ns_refresh">CAREPORTAL NS REFRESH</string>
<string name="uel_profile_switch_ns_refresh">PROFILE SWITCH NS REFRESH</string>
<string name="uel_treatments_ns_refresh">TREATMENTS NS REFRESH</string>
<string name="uel_tt_ns_refresh">TT NS REFRESH</string>
<string name="uel_tt_ns_refresh">TEMP TARGET NS REFRESH</string>
<string name="uel_automation_removed">AUTOMATION REMOVED</string>
<string name="uel_bg_removed">BG REMOVED</string>
<string name="uel_careportal_removed">CAREPORTAL REMOVED</string>
@ -458,7 +458,7 @@
<string name="uel_profile_switch_removed">PROFILE SWITCH REMOVED</string>
<string name="uel_restart_events_removed">RESTART EVENTS REMOVED</string>
<string name="uel_treatment_removed">TREATMENT REMOVED</string>
<string name="uel_tt_removed">TT REMOVED</string>
<string name="uel_tt_removed">TEMP TARGET REMOVED</string>
<string name="uel_ns_paused">NS PAUSED</string>
<string name="uel_ns_resume">NS RESUME</string>
<string name="uel_ns_queue_cleared">NS QUEUE CLEARED</string>
@ -486,7 +486,7 @@
<string name="uel_plugin_enabled">PLUGIN ENABLED</string>
<string name="uel_plugin_disabled">PLUGIN DISABLED</string>
<string name="uel_unknown">UNKNOWN</string>
<string name="ue_formated_string">Formated string</string>
<string name="ue_string">String</string>
<string name="ue_source">Source</string>
<string name="ue_utc_offset">UTC Offset</string>
<string name="ue_action">Action</string>