From b8c7992bbfe03dce665cbd5ba6144b0c8b59b6fd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Feb 2013 20:10:47 -0800 Subject: Improve calculation of maxtemp and mintemp of dive The existing code only populated the maxtemp based on the samples of a dive and then in statistics.c checked if there was no such temperature and replaced it with the water temperature of the first divecomputer. It makes much more sense to add the water temperature information in every divecomputer to the min / max calculation during the dive fixup phase. Signed-off-by: Dirk Hohndel --- statistics.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'statistics.c') diff --git a/statistics.c b/statistics.c index d7abbc592..c08324d54 100644 --- a/statistics.c +++ b/statistics.c @@ -105,19 +105,11 @@ static void process_temperatures(struct dive *dp, stats_t *stats) { int min_temp, mean_temp, max_temp = 0; - if (dp->maxtemp.mkelvin) - max_temp = dp->maxtemp.mkelvin; - else - max_temp = dp->dc.watertemp.mkelvin; - + max_temp = dp->maxtemp.mkelvin; if (max_temp && (!stats->max_temp || max_temp > stats->max_temp)) stats->max_temp = max_temp; - if (dp->mintemp.mkelvin) - min_temp = dp->mintemp.mkelvin; - else - min_temp = dp->dc.watertemp.mkelvin; - + min_temp = dp->mintemp.mkelvin; if (min_temp && (!stats->min_temp || min_temp < stats->min_temp)) stats->min_temp = min_temp; -- cgit v1.2.3-70-g09d2