Show average max depth in yearly statistics

this was requested in #1854 and I think this suggestion makes sense

Fixes #1854

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-12-16 20:52:34 +01:00 committed by bstoeger
parent 99561484ad
commit ac8db01873
5 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,4 @@
- Include average max depth in statistics
- Fix bug in cloud save after removing dives from a trip
- Dive: Perform more accurate OTU calculations, and include
OTU calculations for rebreather dives [#1851 & #1865].

View file

@ -53,6 +53,7 @@ static void process_dive(struct dive *dive, stats_t *stats)
stats->max_depth.mm = dive->maxdepth.mm;
if (stats->min_depth.mm == 0 || dive->maxdepth.mm < stats->min_depth.mm)
stats->min_depth.mm = dive->maxdepth.mm;
stats->combined_max_depth.mm += dive->maxdepth.mm;
process_temperatures(dive, stats);

View file

@ -24,6 +24,7 @@ typedef struct
depth_t max_depth;
depth_t min_depth;
depth_t avg_depth;
depth_t combined_max_depth;
volume_t max_sac;
volume_t min_sac;
volume_t avg_sac;

View file

@ -15,6 +15,7 @@ public:
SHORTEST_TIME,
LONGEST_TIME,
AVG_DEPTH,
AVG_MAX_DEPTH,
MIN_DEPTH,
MAX_DEPTH,
AVG_SAC,
@ -74,6 +75,10 @@ QVariant YearStatisticsItem::data(int column, int role) const
case AVG_DEPTH:
ret = get_depth_string(stats_interval.avg_depth);
break;
case AVG_MAX_DEPTH:
if (stats_interval.selection_size)
ret = get_depth_string(stats_interval.combined_max_depth.mm / stats_interval.selection_size);
break;
case MIN_DEPTH:
ret = get_depth_string(stats_interval.min_depth);
break;
@ -143,6 +148,9 @@ QVariant YearlyStatisticsModel::headerData(int section, Qt::Orientation orientat
case AVG_DEPTH:
val = QString(tr("Depth (%1)\n Average")).arg(get_depth_unit());
break;
case AVG_MAX_DEPTH:
val = tr("\nAverage maximum");
break;
case MIN_DEPTH:
val = tr("\nMinimum");
break;

View file

@ -15,6 +15,7 @@ public:
SHORTEST_TIME,
LONGEST_TIME,
AVG_DEPTH,
AVG_MAX_DEPTH,
MIN_DEPTH,
MAX_DEPTH,
AVG_SAC,