Prefer real data over planned

When a dive has both real dive computers as well as at
least a planned version (which is just another dive
computer with a special name), only use the data from
real dive computers for aggregate values like maxdepth,
dive time, average depth etc in order not to have
imagined data on the dive list, statistics etc.

Macro-magic-provided-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Berthold Stoeger 2022-08-20 17:24:45 +02:00 committed by Dirk Hohndel
parent 1c00f9f233
commit acd385048a
4 changed files with 17 additions and 9 deletions

View file

@ -143,6 +143,10 @@ void split_divecomputer(const struct dive *src, int num, struct dive **out1, str
#define for_each_dc(_dive, _dc) \
for (_dc = &_dive->dc; _dc; _dc = _dc->next)
#define for_each_relevant_dc(_dive, _dc) \
bool _all_planned = !has_planned(_dive, false); \
for (_dc = &_dive->dc; _dc; _dc = _dc->next) if (_all_planned || !is_dc_planner(_dc))
extern struct dive *get_dive_by_uniq_id(int id);
extern int get_idx_by_uniq_id(int id);
extern bool dive_site_has_gps_location(const struct dive_site *ds);