diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-18 21:55:57 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-02-24 11:45:17 -0800 |
commit | 95a23cf4701d4918f866cb5ef1c25a5b2b380096 (patch) | |
tree | d4735ee6e8fe357483f88cab290e1749ad303656 /core/divelogexportlogic.cpp | |
parent | 928e7ed8694e49efdabe3502eef32c4519bf6b0c (diff) | |
download | subsurface-95a23cf4701d4918f866cb5ef1c25a5b2b380096.tar.gz |
Use temperature_t for temperatures in struct stats_t
Use struct temperature_t for temperatures in struct stats_t and
use get_temperature_string() when printing these temperatures for
statistics and HTML export.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core/divelogexportlogic.cpp')
-rw-r--r-- | core/divelogexportlogic.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp index 926dd461c..017689568 100644 --- a/core/divelogexportlogic.cpp +++ b/core/divelogexportlogic.cpp @@ -99,12 +99,15 @@ static void exportHTMLstatistics(const QString filename, struct htmlExportSettin out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\","; out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\","; out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\","; - if ( stats_yearly[i].combined_count ) - out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\","; - else + if ( stats_yearly[i].combined_count ) { + temperature_t avg_temp; + avg_temp.mkelvin = stats_yearly[i].combined_temp.mkelvin / stats_yearly[i].combined_count; + out << "\"AVG_TEMP\":\"" << get_temperature_string(avg_temp) << "\","; + } else { out << "\"AVG_TEMP\":\"0.0\","; - out << "\"MIN_TEMP\":\"" << ( stats_yearly[i].min_temp == 0 ? 0 : get_temp_units(stats_yearly[i].min_temp, NULL)) << "\","; - out << "\"MAX_TEMP\":\"" << ( stats_yearly[i].max_temp == 0 ? 0 : get_temp_units(stats_yearly[i].max_temp, NULL)) << "\","; + } + out << "\"MIN_TEMP\":\"" << ( stats_yearly[i].min_temp.mkelvin == 0 ? 0 : get_temperature_string(stats_yearly[i].min_temp)) << "\","; + out << "\"MAX_TEMP\":\"" << ( stats_yearly[i].max_temp.mkelvin == 0 ? 0 : get_temperature_string(stats_yearly[i].max_temp)) << "\","; out << "},"; total_stats.selection_size += stats_yearly[i].selection_size; total_stats.total_time.seconds += stats_yearly[i].total_time.seconds; |