The final part (and one of the reasons) for the mainwindow
refactoring -- we now support tabbed athletes rather than
having a new mainwindow for each athlete opened.
Context is saved/restored and there are new functions for
opening and closing tabs and windows of tabs.
The tabbar itself is fugly -- the next few days will spend
some time looking at making it prettier on Linux/Win and
more native on Mac (see MMTabBar).
.. let the user choose metadata texts to filter
by value in the sidebar.
Note there are issues;
1. the value lists are not updated automatically when
rides are updated or imported and values are added
or removed.
2. it only works with shorttext metadata fields, we might
choose to add numeric etc later.
3. it would be nice to get an indication of how many
activities contain the value and maybe even sort
by count.
Looks at the max and min (non-zero) power values and
uses the difference between them to calculate a fatigue
index as a percentage.
i.e.
FI = (maxP - minP) / maxP * 100.00;
This is really only useful for targetted intervals as for
most riding there will always be a period of time where
the rider coasts or takes it easy.
We may look to improve it by smoothing or comparing to the
average power instead of minimum power.
Fixup crashes and major issues created by porting
to QT5. These have included;
* Fix CP plot log scale
* AllPlot axes and tooltip
* DBAccess prepare/bind bug
* LTMSettings crash
* LTMWindow zoomer/picker crash
* LTMPlot axes hack
There are still issues remaining but we can start
working through them at leisure -- the product now
builds and runs.
Added an average aPower metric.
I also and found and fixed a couple of bugs along the way;
* intervals create a ridefile and need to explicitly call
recalculateDerivedMetrics()
* the aPower calculation was using the calculated vo2max
percentage the wrong way around (!)
It TREBLES the amount of time required to refresh the
metrics, so will need to be optmised before 3.1 is released.
But it should only need to run once.
I've also added a 'RideMetric::Low' type which we could
also apply to weight.
The current TIZ metrics only allow you to chart the
absolute time in zone. Over longer periods it can be
helpful to look at the overall ratio of intensities
trained at.
There still some assert left in the code, but removed
a fair number of the examples where, its just as easy
to handle the condition gracefully, without crashing.
By 3.1 we will have eradicated assert from the code.
A bit of a mix of stuff, but basically the Athlete
class has sql stuff in it, that DBAccess used but
also referenced a session number in MainWindow.
Removed the interdependency and moved all code to do
with DB to DBAccess and out of MainWindow and Athlete.
At the same time needed to clean up a bit of memory
management and so introduced a MainWindow and Athlete
destructor.
We are now ready to do refactor part 4 to split MainWindow
into a new View class (that will be in each tab).
Decoupled classes from MainWindow to reference Context
and Athlete (and introduced a couple of new headers).
We no longer pass around a MainWindow pointer to children
but pass a context instead.
There are still a few pieces left in MainWindow that need
to move to a better place;
* Setting/clearing filter selection
* Working with Intervals
* Adding/Deleting Rides
* Save on Exit
As mentioned previously there are lots of other parts to
this refactor left to do;
* break MainWindow Gui elements into Toolbar and Views
* migrate from RideItem and Ridelist to ActivityCollection
and Activity classes that are not tied into gui elements.
* introduce Application Context and AthleteCollection
Breaking the MainWindow 'god object' into
separate classes for Athlete and Context.
Further updates will need to;
- break MainWindow Gui elements into Toolbar and Views
- migrate from RideItem and Ridelist to ActivityCollection
and Activity classes that are not tied into gui elements.
- introduce Application Context and AthleteCollection
Once these are done we will be in a position to decouple
most classes from mainwindow and also introduce tabbed
athletes.
The call to RideFile::getWeight() in RideFileCache
computation ends up with a call the read the measures
table in the DB. This is BAD since it is called from
a thread.
We now call getWeight() in the metric aggregator before
launching the ridefilecache computation -- this will cache
the weight and avoid db access.
I've also removed the duplicate code in the w/kg metric code
too and it should be marginally faster at computing metrics
now.
BIG THANKS TO ILJA BOOIJ FOR HIGHLIGHTING THIS, DESPITE MY
INITIAL SCEPTICISM. I OWE HIM A PINT (OR TWO) :)
Fixes#604
Update to the histogram plot to now plot long term metrics.
It enables you to plot distribution of say, Intensity Factor
for a season or cycle.
You can select the y-axis metric too, so rather than just
plotting duration you could plot say, TSS accumulated for
different ride intensities.
Fixes#560
1. Use the whitespace analyzer so its easier to search for
tokens that are a mix of letters and numbers e.g. workout
codes and TT route names.
2. Search as you type. Since we have very small collections
to search across (typically no more than a couple of thousand)
there is no major overhead in searching as you type.
3. Search all texts by default not just the Notes field. This is
a more appropriate default and is less likely to confuse new
users. In addition, it is most likely what most users want to
do anyway.
Last commit added a new metric but didn't increment the DBAccess
DB schema version, causing DB functions to break. This patch just
increments the version to ensure the DB is rebuilt to include
the new metric.
A few months ago I commented out the calculation of metrics
for manual ride files. This was a hack to avoid fixing the code
to handle metric calculations from overrides where there are no
data points.
This annoyingly meant that the 'rides' metric was zero for manual
ride files, and any derived metrics similarly were zero.
This patch fixes that.
This might be meaningless for actual analysis, but helps to match numbers
of devices, that exclude time with zero power from the average
calculation.
While it's controversal to be usefull, this leaves the choice to the user.
There was a unit conversion from km->miles being applied to cadence. I have
removed the offending line.
I've also changed the precision so the we report cadence as an integer.
Fixes#601.
More complex than I had hoped for, to add
Temperature I needed to;
* introduce two new metrics Avg/Max temperature
* adjust metric conversion to include a conversionSum
for the C to F conversion
* handle temperature as a metadata field as well as a
ride data series
* handle the RideFile::noTemp value rather than just
averaging or calculating max.
Fixes#603.
All the existing wpk metrics concentrate
on the wpk for a fixed period, which is great
but we should also support it for an interval
(where it is arguably most interesting).
This patch fixes that.
Fixes#467.
Some users often switch between v2 and v3 of GC. Either
because they are testing or they are transitioning from
v2 stable to v3 development builds.
But at launch the metricDB is refreshed each time, since
the v2 and v3 metrics are so different.
To avoid this, from version 3 the metricDB file will be
called metricDBv3 to avoid conflicting with the original
metricDB file.
Fixes#376.
A popup bubble when hovering over the activity
history or an entry on the calendar.
It is a pre-cursor for the activity bar for
selecting rides and is available for any
widget to call (it is a member of mainwindow).
To support the data series indicator icons a
new metadata field 'Data' has been added to
store a string to represent the data series
that are present.
In addition, the Sport code is used to decide
if a bike/run/swim icon should be shown instead
of a string (but needs translation support when
we get round to that).
Lastly, it has been coded for horizontal alignment
but will need to be updated for the activity bar
to support vertical alignment.
This is an experimental feature and will develop
over time, specifically;
* you cannot define which metrics are show in the
bubble -- they are hardcoded at present
* the coloring is hardcoded, as is the font size
* Only the activity list and diary use it.
The background color on the calendar now reflects
the color configration.
The color for each ride is precomputed and stored
in the metricDB (so we don't have to scan the ride
everytime we need to determine its color).
As a happy by-product the ride navigator no longer
scans the text to determine the row color and is an
order of magnitude faster when repainting (although
most users are unlikely to notice in practice).
Fixes#448.
The DBAccess functions instantiate a local SpecialFields object in
almost every method. Profiling by Fredrik Lingvall has shown this
is rather expensive (and also unneccessary since they do not
change at runtime).
A specialFields member has been added to the MainWindow class
and is instantiated at startup and referenced in the DBAccess
methods instead.
Rough tests suggest a 10% speed improvement in metric refreshes.