Added heartbeats metric

.. count of heartbeats per interval
This commit is contained in:
Mark Liversedge
2015-02-23 16:10:43 +00:00
parent 9fe586eec3
commit 7121bb8084
2 changed files with 41 additions and 1 deletions

View File

@@ -895,6 +895,45 @@ static bool avgHeartRateAdded =
///////////////////////////////////////////////////////////////////////////////
struct HeartBeats : public RideMetric {
Q_DECLARE_TR_FUNCTIONS(HeartBeats)
double total;
public:
HeartBeats()
{
setSymbol("heartbeats");
setInternalName("Heartbeats");
}
void initialize() {
setName(tr("Heartbeats"));
setMetricUnits(tr("beats"));
setImperialUnits(tr("beats"));
setType(RideMetric::Total);
}
void compute(const RideFile *ride, const Zones *, int,
const HrZones *, int,
const QHash<QString,RideMetric*> &,
const Context *) {
total = 0;
foreach (const RideFilePoint *point, ride->dataPoints()) {
total += (point->hr / 60) * ride->recIntSecs();
}
setValue(total);
}
bool isRelevantForRide(const RideItem *ride) const { return ride->present.contains("H"); }
RideMetric *clone() const { return new HeartBeats(*this); }
};
static bool hbAdded =
RideMetricFactory::instance().addMetric(HeartBeats());
////////////////////////////////////////////////////////////////////////////////
class HrPw : public RideMetric {
Q_DECLARE_TR_FUNCTIONS(HrPw)

View File

@@ -106,8 +106,9 @@
// 100 05 Feb 2015 Ale Martinez Use duration not time moving when its 0 (rpe metrics)
// 101 05 Feb 2015 Mark Liversedge aPower versions of Coggan metrics aNP et al
// 102 05 Feb 2015 Mark Liversedge aPower versions of Skiba metrics aBikeScore et al
// 103 23 Feb 2015 Mark Liversedge Added total heartbeats
int DBSchemaVersion = 102;
int DBSchemaVersion = 103;
RideMetricFactory *RideMetricFactory::_instance;
QVector<QString> RideMetricFactory::noDeps;