Don't include runs in estimates

.. estimates should be sport specific (modality)

.. this is a hack to fixup cycling, but the whole estimate
   code needs to be reworked as it isn't well thought through
   and isn't well integrated into the rest of the code.

.. thanks to Jon Beverley for heads up and code fixes.
This commit is contained in:
Mark Liversedge
2016-01-04 15:58:56 +00:00
parent a8fa534501
commit 33de17a364
3 changed files with 9 additions and 4 deletions

View File

@@ -679,7 +679,8 @@ RideCache::refreshCPModelMetrics()
// what dates have any power data ?
foreach(RideItem *item, rides()) {
if (item->present.contains("P")) {
// has power, but not running
if (item->present.contains("P") && !item->isRun) {
// no date set
if (from == QDate()) from = item->dateTime.date();
@@ -727,7 +728,9 @@ RideCache::refreshCPModelMetrics()
// months is a rolling 3 months sets of bests
QVector<float> wpk; // for getting the wpk values
bests.addBests(RideFileCache::meanMaxPowerFor(context, wpk, begin, end));
// don't include RUNS ..................................................vvvvv
bests.addBests(RideFileCache::meanMaxPowerFor(context, wpk, begin, end, false));
bestsWPK.addBests(wpk);
// we now have the data

View File

@@ -299,7 +299,7 @@ static long countForMeanMax(RideFileCacheHeader head, RideFile::SeriesType serie
return 0;
}
QVector<float> RideFileCache::meanMaxPowerFor(Context *context, QVector<float> &wpk, QDate from, QDate to)
QVector<float> RideFileCache::meanMaxPowerFor(Context *context, QVector<float> &wpk, QDate from, QDate to, bool wantruns)
{
QVector<float> returning;
QVector<float> returningwpk;
@@ -310,6 +310,8 @@ QVector<float> RideFileCache::meanMaxPowerFor(Context *context, QVector<float> &
if (item->dateTime.date() < from || item->dateTime.date() > to) continue; // not one we want
if (item->isRun && !wantruns) continue; // they don't want runs
// get the power data
if (first == true) {

View File

@@ -168,7 +168,7 @@ class RideFileCache
static bool checkStale(Context *context, RideItem*item);
// Just get mean max values for power & wpk for a ride
static QVector<float> meanMaxPowerFor(Context *context, QVector<float>&wpk, QDate from, QDate to);
static QVector<float> meanMaxPowerFor(Context *context, QVector<float>&wpk, QDate from, QDate to, bool wantruns=true);
static QVector<float> meanMaxPowerFor(Context *context, QVector<float>&wpk, QString filename);
// Fast standalone search reads input and outputs into ride_bests