diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java
index 6bd94215cd..d8bb5a07c8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java
@@ -23,15 +23,29 @@ public class ComboTddHistoryDialog extends DialogFragment {
if (tdds.isEmpty()) {
text.setText(R.string.combo_empty_tdd_history_note);
} else {
- boolean first = true;
StringBuilder sb = new StringBuilder();
DateFormat dateFormatter = DateFormat.getDateInstance();
+ double avg = 0;
+ double min = 999;
+ double max = 0;
+ int count = 0;
for (Tdd tdd : tdds) {
- if (first) {
- first = false;
- } else {
- sb.append("\n");
+ if (tdd.total > 0) {
+ avg += tdd.total;
+ count++;
}
+ if (tdd.total < min) min = tdd.total;
+ if (tdd.total > max) max = tdd.total;
+ }
+ avg = avg / count;
+ sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_minimum), min));
+ sb.append("\n");
+ sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_average), avg));
+ sb.append("\n");
+ sb.append(String.format(Locale.getDefault(), getString(R.string.combo_tdd_maximum), max));
+ sb.append("\n");
+ for (Tdd tdd : tdds) {
+ sb.append("\n");
sb.append(dateFormatter.format(tdd.timestamp));
sb.append(" ");
sb.append(String.format(Locale.getDefault(), "%3.1f", tdd.total));
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5140eb0b56..8475f64a6a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -817,5 +817,8 @@
To retrieve the alert history from the pump, long press the Refresh button.
To retrieve the TDD history from the pump, long press the Refresh button.
sync_profile_to_pump
+ Minimum: %3.1f U
+ Average: %3.1f U
+ Maximum: %3.1f U