mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
In statistics, ignore gas use of planned dives
When merged with real dives, those would double count otherwise. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
a031dbbbd8
commit
1d8662006c
8 changed files with 16 additions and 14 deletions
|
@ -326,16 +326,18 @@ void get_selected_dives_text(char *buffer, size_t size)
|
|||
|
||||
#define SOME_GAS 5000 // 5bar drop in cylinder pressure makes cylinder used
|
||||
|
||||
bool is_cylinder_used(struct dive *dive, int idx)
|
||||
bool is_cylinder_used(struct dive *dive, int idx, bool ignore_plannned)
|
||||
{
|
||||
struct divecomputer *dc;
|
||||
bool firstGasExplicit = false;
|
||||
if (cylinder_none(&dive->cylinder[idx]))
|
||||
return false;
|
||||
|
||||
if ((dive->cylinder[idx].start.mbar - dive->cylinder[idx].end.mbar) > SOME_GAS)
|
||||
if ((dive->cylinder[idx].start.mbar - dive->cylinder[idx].end.mbar) > SOME_GAS && !ignore_plannned)
|
||||
return true;
|
||||
for_each_dc(dive, dc) {
|
||||
if (ignore_plannned && !strcmp(dc->model, "planned dive"))
|
||||
continue;
|
||||
struct event *event = get_next_event(dc->events, "gaschange");
|
||||
while (event) {
|
||||
if (dc->sample && (event->time.seconds == 0 ||
|
||||
|
@ -360,7 +362,7 @@ void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS])
|
|||
cylinder_t *cyl = &dive->cylinder[idx];
|
||||
pressure_t start, end;
|
||||
|
||||
if (!is_cylinder_used(dive, idx))
|
||||
if (!is_cylinder_used(dive, idx, true))
|
||||
continue;
|
||||
|
||||
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue