diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/divelogexportlogic.cpp | 2 | ||||
-rw-r--r-- | core/statistics.c | 6 | ||||
-rw-r--r-- | core/statistics.h | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp index 27a42fbf7..1a0779422 100644 --- a/core/divelogexportlogic.cpp +++ b/core/divelogexportlogic.cpp @@ -79,7 +79,7 @@ static void exportHTMLstatistics(const QString filename, struct htmlExportSettin stats_t total_stats; - calculate_stats_summary(&stats); + calculate_stats_summary(&stats, hes.selectedOnly); total_stats.selection_size = 0; total_stats.total_time.seconds = 0; 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 */ diff --git a/core/statistics.h b/core/statistics.h index d0cf5ab67..d3707b9cb 100644 --- a/core/statistics.h +++ b/core/statistics.h @@ -52,7 +52,7 @@ extern "C" { extern char *get_minutes(int seconds); extern void init_stats_summary(struct stats_summary *stats); extern void free_stats_summary(struct stats_summary *stats); -extern void calculate_stats_summary(struct stats_summary *stats); +extern void calculate_stats_summary(struct stats_summary *stats, bool selected_only); extern void calculate_stats_selected(stats_t *stats_selection); extern void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS]); extern void selected_dives_gas_parts(volume_t *o2_tot, volume_t *he_tot); |