UserEntryPresentationHelper / csv improvement
This commit is contained in:
parent
4cadec78e5
commit
98aac56c1c
2 changed files with 16 additions and 16 deletions
|
@ -152,7 +152,7 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
csvString(R.string.eventtype),
|
csvString(R.string.eventtype),
|
||||||
csvString(R.string.ue_source),
|
csvString(R.string.ue_source),
|
||||||
csvString(R.string.careportal_note),
|
csvString(R.string.careportal_note),
|
||||||
csvString(R.string.ue_formated_string),
|
csvString(R.string.ue_string),
|
||||||
csvString(R.string.event_time_label),
|
csvString(R.string.event_time_label),
|
||||||
csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol),
|
csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol),
|
||||||
csvString(R.string.shortgram),
|
csvString(R.string.shortgram),
|
||||||
|
@ -165,15 +165,15 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
) + "\n"
|
) + "\n"
|
||||||
|
|
||||||
private fun getCsvEntry(entry: UserEntry): String {
|
private fun getCsvEntry(entry: UserEntry): String {
|
||||||
val fullvalueWithUnitList = ArrayList<ValueWithUnit?>(entry.values)
|
val fullvalueWithUnitList = ArrayList(entry.values)
|
||||||
var timestampRec = "" + entry.timestamp
|
val timestampRec = entry.timestamp.toString()
|
||||||
var dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
|
val dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
|
||||||
var utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt())
|
val utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt())
|
||||||
var action = csvString(entry.action)
|
val action = csvString(entry.action)
|
||||||
var therapyEvent = ""
|
var therapyEvent = ""
|
||||||
var source = translator.translate(entry.source)
|
val source = translator.translate(entry.source)
|
||||||
var note = csvString(entry.note)
|
val note = csvString(entry.note)
|
||||||
var stringResource = ""
|
var simpleString = ""
|
||||||
var timestamp = ""
|
var timestamp = ""
|
||||||
var bg = ""
|
var bg = ""
|
||||||
var gram = ""
|
var gram = ""
|
||||||
|
@ -182,7 +182,7 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
var percent = ""
|
var percent = ""
|
||||||
var hour = ""
|
var hour = ""
|
||||||
var minute = ""
|
var minute = ""
|
||||||
var other = ""
|
var noUnit = ""
|
||||||
|
|
||||||
for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) {
|
for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) {
|
||||||
when (valueWithUnit) {
|
when (valueWithUnit) {
|
||||||
|
@ -192,8 +192,8 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
|
is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
|
||||||
is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
|
is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
|
||||||
is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
|
is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
|
||||||
is ValueWithUnit.SimpleInt -> other = other.addWithSeparator(valueWithUnit.value)
|
is ValueWithUnit.SimpleInt -> noUnit = noUnit.addWithSeparator(valueWithUnit.value)
|
||||||
is ValueWithUnit.SimpleString -> other = other.addWithSeparator(valueWithUnit.value)
|
is ValueWithUnit.SimpleString -> simpleString = simpleString.addWithSeparator(valueWithUnit.value)
|
||||||
is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
|
is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
|
||||||
is ValueWithUnit.TherapyEventTTReason -> 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))
|
is ValueWithUnit.TherapyEventType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
|
||||||
|
@ -210,9 +210,9 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
therapyEvent = csvString(therapyEvent)
|
therapyEvent = csvString(therapyEvent)
|
||||||
stringResource = csvString(stringResource)
|
simpleString = csvString(simpleString)
|
||||||
other = csvString(other)
|
noUnit = csvString(noUnit)
|
||||||
return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$stringResource;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$other"
|
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"," / ") + "\""
|
private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"").replace("\n"," / ") + "\""
|
||||||
|
|
|
@ -486,7 +486,7 @@
|
||||||
<string name="uel_plugin_enabled">PLUGIN ENABLED</string>
|
<string name="uel_plugin_enabled">PLUGIN ENABLED</string>
|
||||||
<string name="uel_plugin_disabled">PLUGIN DISABLED</string>
|
<string name="uel_plugin_disabled">PLUGIN DISABLED</string>
|
||||||
<string name="uel_unknown">UNKNOWN</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_source">Source</string>
|
||||||
<string name="ue_utc_offset">UTC Offset</string>
|
<string name="ue_utc_offset">UTC Offset</string>
|
||||||
<string name="ue_action">Action</string>
|
<string name="ue_action">Action</string>
|
||||||
|
|
Loading…
Reference in a new issue