From 13cc5afb7f3e0873d6fc94a9cbdfafc1b05d3800 Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen Date: Tue, 16 Oct 2012 18:14:34 +0200 Subject: Avoid zero degrees Kelvin in yearly statistics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maximum and minimum degrees in the yearly statistics were displayed as -273.1°C if no temperature info was present. H From 7d9aad01133bc03980f66a2d109c9ef909e518ad Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen Date: Tue, 16 Oct 2012 18:13:16 +0200 Subject: [PATCH] Avoid zero degrees Kelvin in yearly statistics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maximum and minimum degrees in the yearly statistics were displayed as -273.1°C if no temperature info was present. Signed-off-by: Henrik Brautaset Aronsen Signed-off-by: Dirk Hohndel --- statistics.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/statistics.c b/statistics.c index fe379505b..047c6ea1e 100644 --- a/statistics.c +++ b/statistics.c @@ -290,12 +290,20 @@ static void process_interval_stats(stats_t stats_interval, GtkTreeIter *parent, add_cell_to_tree(store, "", 12, row); } /* Coldest water temperature */ - snprintf(value_str, sizeof(value_str), "%.1f %s\t", value, unit); - add_cell_to_tree(store, value_str, 13, row); + if (value > -100.0) { + snprintf(value_str, sizeof(value_str), "%.1f %s\t", value, unit); + add_cell_to_tree(store, value_str, 13, row); + } else { + add_cell_to_tree(store, "", 13, row); + } /* Warmest water temperature */ value = get_temp_units(stats_interval.max_temp, &unit); - snprintf(value_str, sizeof(value_str), "%.1f %s", value, unit); - add_cell_to_tree(store, value_str, 14, row); + if (value > -100.0) { + snprintf(value_str, sizeof(value_str), "%.1f %s", value, unit); + add_cell_to_tree(store, value_str, 14, row); + } else { + add_cell_to_tree(store, "", 14, row); + } } void clear_statistics() -- cgit v1.2.3-70-g09d2