subsurface/backend-shared/divesummary.h
Dirk Hohndel 08e39f9d2d mobile/dive summary: rewrite statistics code
There were quite a few issues with the code - clearly a complete failure of
code review.

- all values were '??' if a period contained no dives
- imperial units were not calculated at all
- significant truncation and data loss in the way totals were added as meters
  and minutes instead of the higher precision data that is available
- several issues in striing conversion methodology, e.g. missing zero padding
  for minutes
- missing maxSac
- incorrectly calculated avgSac
- incorrectly claculated number of EANx dives
- hard to read code with most variables named 'temp'

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:45:25 +02:00

29 lines
804 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef DIVESUMMARY_H
#define DIVESUMMARY_H
#include <QStringList>
#include "core/dive.h"
class diveSummary {
public:
static void summaryCalculation(int primaryPeriod, int secondaryPeriod);
static QStringList diveSummaryText;
private:
diveSummary() {}
static void loopDives(timestamp_t primaryStart, timestamp_t secondaryStart);
static void calculateDive(int inx, struct dive *dive);
static void buildStringList(int inx);
static timestamp_t firstDive, lastDive;
static int dives[2], divesEAN[2], divesDeep[2], diveplans[2];
static long divetime[2], depth[2];
static long divetimeMax[2], depthMax[2], sacMin[2], sacMax[2];
static long divetimeAvg[2], depthAvg[2], sacAvg[2];
static long totalSACTime[2], totalSacVolume[2];
};
#endif // DIVESUMMARY_H