Skip to content

Commit

Permalink
Remove old references to SummaryMetrics
Browse files Browse the repository at this point in the history
.. cleaning up from last few commits.
  • Loading branch information
liversedge committed Dec 18, 2014
1 parent d1d1d88 commit eb3b245
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 63 deletions.
1 change: 0 additions & 1 deletion src/CompareDateRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "Context.h"
#include "RideFileCache.h"
#include "Season.h"
#include "SummaryMetrics.h"
#include <QColor>

RideFileCache *
Expand Down
2 changes: 0 additions & 2 deletions src/CompareDateRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
class Context;
class RideFileCache;

#include "SummaryMetrics.h"
#include "Specification.h"

#include <QColor>
Expand All @@ -39,7 +38,6 @@ class CompareDateRange
QString name;
QColor color;
Specification specification;
QList<SummaryMetrics> metrics; //XXX soon to be deprecated
QDate start, end;
int days;
Context *sourceContext;
Expand Down
18 changes: 2 additions & 16 deletions src/ComparePane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include "Units.h"
#include "Zones.h"

#include "MetricAggregator.h"
#include "SummaryMetrics.h"

#include <QCheckBox>
#include <QTextEdit>

Expand Down Expand Up @@ -247,17 +244,11 @@ ComparePane::refreshTable()
foreach(CompareInterval x, context->compareIntervals) {

// compute the metrics for this ride
SummaryMetrics metrics;
RideItem metrics;
QHash<QString, RideMetricPtr> computed = RideMetric::computeMetrics(context, x.data,
context->athlete->zones(), context->athlete->hrZones(), worklist);

for(int i = 0; i < worklist.count(); i++) {
if (worklist[i] != "") {
RideMetricPtr m = computed.value(worklist[i]);
if (m) metrics.setForSymbol(worklist[i], m->value(true));
else metrics.setForSymbol(worklist[i], 0.00);
}
}
metrics.setFrom(computed);

// First few cols always the same
// check - color - athlete - date - time
Expand Down Expand Up @@ -782,11 +773,6 @@ ComparePane::dropEvent(QDropEvent *event)
// for now the specification is just a date range
add.specification.setDateRange(DateRange(add.start,add.end));

// get summary metrics for the season
// FROM THE SOURCE CONTEXT
// WE DON'T FETCH BESTS -- THEY NEED TO BE DONE AS NEEDED
add.metrics = sourceContext->athlete->metricDB->getAllMetricsFor(QDateTime(add.start, QTime()),QDateTime(add.end, QTime()));

// just use standard colors and cycle round
// we will of course repeat, but the user can
// just edit them using the button
Expand Down
3 changes: 0 additions & 3 deletions src/HistogramWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "Context.h"
#include "Athlete.h"
#include "MetricAggregator.h"
#include "SummaryMetrics.h"
#include "ChartSettings.h"
#include "ColorButton.h"
#include "PowerHist.h"
Expand All @@ -35,7 +34,6 @@

#include "Zones.h"
#include "HrZones.h"
#include "SummaryMetrics.h"

#include "Season.h"
#include "SeasonParser.h"
Expand Down Expand Up @@ -264,7 +262,6 @@ class HistogramWindow : public GcChartWindow
// to have a slight lag before redrawing since it is expensive
// and users are likely to move up and down with the arrow keys
ColorButton *colorButton;
QList<SummaryMetrics> results;
DateRange last;
};

Expand Down
1 change: 1 addition & 0 deletions src/LTMPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "Context.h"

class SummaryMetrics; // for PMC curves, going soon XXX
class LTMPlotBackground;
class LTMWindow;
class LTMPlotZoneLabel;
Expand Down
1 change: 0 additions & 1 deletion src/LTMSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

class LTMTool;
class LTMSettings;
class SummaryMetrics;
class Context;
class RideMetric;
class RideBest;
Expand Down
1 change: 0 additions & 1 deletion src/Lucene.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include "Context.h"
#include "RideMetadata.h"
#include "SummaryMetrics.h"
#include "RideFile.h"

#include "CLucene.h"
Expand Down
34 changes: 0 additions & 34 deletions src/MetricAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,6 @@ MetricAggregator::refreshBestIntervals()
}
#endif



/*----------------------------------------------------------------------
* Calculate the metrics for a ride file using the metrics factory
*----------------------------------------------------------------------*/
Expand Down Expand Up @@ -555,35 +553,3 @@ bool MetricAggregator::importRide(QDir /* no longer used ? */, RideFile *ride, Q

return true;
}

/*----------------------------------------------------------------------
* Query functions are wrappers around DBAccess functions
*----------------------------------------------------------------------*/

QList<SummaryMetrics>
MetricAggregator::getAllMetricsFor(DateRange dr)
{
return getAllMetricsFor(QDateTime(dr.from, QTime(0,0,0)), QDateTime(dr.to, QTime(23,59,59)));
}

QList<SummaryMetrics>
MetricAggregator::getAllMetricsFor(QDateTime start, QDateTime end)
{
if (context->athlete->isclean == false) refreshMetrics(); // get them up-to-date

QList<SummaryMetrics> empty;

// only if we have established a connection to the database
if (dbaccess == NULL) {
qDebug()<<"lost db connection?";
return empty;
}

// apparently using transactions for queries
// can improve performance!
dbaccess->connection().transaction();
QList<SummaryMetrics> results = dbaccess->getAllMetricsFor(start, end);
dbaccess->connection().commit();
return results;
}

3 changes: 0 additions & 3 deletions src/MetricAggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class MetricAggregator : public QObject
void refreshMetrics(QDateTime forceAfterThisDate);

DBAccess *db() { return dbaccess; }
//SummaryMetrics getAllMetricsFor(QString filename); // for a single ride
QList<SummaryMetrics> getAllMetricsFor(QDateTime start, QDateTime end);
QList<SummaryMetrics> getAllMetricsFor(DateRange);

signals:
void dataChanged(); // when metricDB table changed
Expand Down
1 change: 0 additions & 1 deletion src/TreeMapWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ class TreeMapWindow : public GcWindow
QList<KeywordDefinition> keywordDefinitions;
QList<FieldDefinition> fieldDefinitions;
QList<DefaultDefinition> defaultDefinitions;
QList<SummaryMetrics> results;

// Widgets
QVBoxLayout *mainLayout;
Expand Down
1 change: 0 additions & 1 deletion src/TwitterDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ private slots:

RideItem *ride;
QString getTwitterMessage();
QString metricToString(const RideMetric *m, SummaryMetrics &metrics, bool metricUnits);
};

#endif // TWITTERDIALOG_H

0 comments on commit eb3b245

Please sign in to comment.