summaryrefslogtreecommitdiffstats
path: root/core/statistics.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-06 16:50:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-07 17:50:51 +0300
commitdf16866292ac16430e840ccc0013a5914303cd0f (patch)
tree5fb145cbf2b8da6d37bb5b9e7b4d669c7fd90df2 /core/statistics.c
parentb61f6f66d8859e62023e3818879b90de529e9a72 (diff)
downloadsubsurface-df16866292ac16430e840ccc0013a5914303cd0f.tar.gz
Statistics: only consider selected dives in HTML export statistics
If only selected dives were exported into HTML, the statistics would nevertheless cover all dives. A counter-intuitive behavior. Fix by adding a selected_only flag to calculate_stats_summary(). Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/statistics.c')
-rw-r--r--core/statistics.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/statistics.c b/core/statistics.c
index 5d9c8049a..6f5efe64f 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -3,7 +3,7 @@
*
* core logic for the Info & Stats page -
* char *get_minutes(int seconds);
- * void calculate_stats_summary(struct stats_summary *out);
+ * void calculate_stats_summary(struct stats_summary *out, bool selected_only);
* void calculate_stats_selected(stats_t *stats_selection);
*/
#include "gettext.h"
@@ -91,7 +91,7 @@ char *get_minutes(int seconds)
* Before first use, it should be initialized with init_stats_summary().
* After use, memory must be released with free_stats_summary().
*/
-void calculate_stats_summary(struct stats_summary *out)
+void calculate_stats_summary(struct stats_summary *out, bool selected_only)
{
int idx;
struct dive *dp;
@@ -147,6 +147,8 @@ void calculate_stats_summary(struct stats_summary *out)
/* this relies on the fact that the dives in the dive_table
* are in chronological order */
for_each_dive (idx, dp) {
+ if (selected_only && !dp->selected)
+ continue;
process_dive(dp, &stats);
/* yearly statistics */