mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 01:19:57 +00:00
Metric Aggregation ::aggregateZero() method
.. when aggregating metrics across rides we were being inconsistent with regards how we handled zero values; we sometimes included them and sometimes didn't. .. now added a metric method bool aggregateZero() that returns true if aggregates need to include zero values .. this has been implemented where averages are aggregated.
This commit is contained in:
@@ -945,6 +945,9 @@ LTMWindow::refreshDataTable()
|
||||
// ignore estimates for now XXX just to stop it crashing
|
||||
if (metricDetail.type == METRIC_ESTIMATE) continue;
|
||||
|
||||
// do we aggregate zero values ?
|
||||
bool aggZero = metricDetail.metric ? metricDetail.metric->aggregateZero() : false;
|
||||
|
||||
QList<SummaryMetrics> *data = NULL; // source data (metrics, bests etc)
|
||||
GroupedData a; // aggregated data
|
||||
|
||||
@@ -1025,7 +1028,9 @@ LTMWindow::refreshDataTable()
|
||||
|
||||
a.y[n] = value;
|
||||
a.x[n] = currentDay - groupForDate(settings.start.date());
|
||||
secondsPerGroupBy = seconds; // reset for new group
|
||||
|
||||
if (value || aggZero) secondsPerGroupBy = seconds; // reset for new group
|
||||
|
||||
} else {
|
||||
// sum totals, average averages and choose best for Peaks
|
||||
int type = metricDetail.metric ? metricDetail.metric->type() : RideMetric::Average;
|
||||
@@ -1047,7 +1052,7 @@ LTMWindow::refreshDataTable()
|
||||
// average should be calculated taking into account
|
||||
// the duration of the ride, otherwise high value but
|
||||
// short rides will skew the overall average
|
||||
a.y[n] = ((a.y[n]*secondsPerGroupBy)+(seconds*value)) / (secondsPerGroupBy+seconds);
|
||||
if (value || aggZero) a.y[n] = ((a.y[n]*secondsPerGroupBy)+(seconds*value)) / (secondsPerGroupBy+seconds);
|
||||
break;
|
||||
}
|
||||
case RideMetric::Low:
|
||||
|
||||
Reference in New Issue
Block a user