Subtract setup units from displayed total insulin delivered

This commit is contained in:
Steffen Müthing 2020-08-23 18:02:38 +02:00
parent f3a7a5a393
commit 633767ad3d
2 changed files with 8 additions and 1 deletions

View file

@ -281,7 +281,13 @@ class OmnipodFragment : DaggerFragment() {
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: "-" .getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: "-"
// total delivered // total delivered
omnipod_total_delivered.text = resourceHelper.gs(R.string.omnipod_total_delivered,podStateManager.totalInsulinDelivered); omnipod_total_delivered.text = podStateManager.totalInsulinDelivered.let {
when {
it == null -> "-"
it < OmnipodConst.POD_SETUP_UNITS -> resourceHelper.gs(R.string.omnipod_total_delivered_pod_preparing)
else -> resourceHelper.gs(R.string.omnipod_total_delivered, it - OmnipodConst.POD_SETUP_UNITS);
}
}
// reservoir // reservoir
if (podStateManager.reservoirLevel == null) { if (podStateManager.reservoirLevel == null) {

View file

@ -27,6 +27,7 @@
<string name="omnipod_pod_mgmt">Pod Mgmt</string> <string name="omnipod_pod_mgmt">Pod Mgmt</string>
<string name="omnipod_pod_status">Pod Status</string> <string name="omnipod_pod_status">Pod Status</string>
<string name="omnipod_total_delivered_label">Total Delivered</string> <string name="omnipod_total_delivered_label">Total Delivered</string>
<string name="omnipod_total_delivered_pod_preparing">Pod Preparing</string>
<string name="omnipod_total_delivered">%1$.2f U</string> <string name="omnipod_total_delivered">%1$.2f U</string>
<string name="omnipod_reservoir_left">%1$.2f U left</string> <string name="omnipod_reservoir_left">%1$.2f U left</string>
<string name="omnipod_reservoir_over50">Over 50 U</string> <string name="omnipod_reservoir_over50">Over 50 U</string>