.. moved the overwrite of the withings cached response
to when we know we got something successfully.
.. previously we overwrote regardless of what we received
which means that when we have firewall/network type issues
the cache was overwritten with blank data !
.. but only refreshes the ride added rather than looking everywhere.
So, when we are importing large numbers of activities it won't
repeatedly run a full refresh (which was bonkers).
.. if we close GC during a background refresh operation
then the refresh is cancelled and cache saved in whatever
state it is in now .. the user clearly didn't want to wait !
.. when refresh() is called for a rideitem it will
now compute the metrics for the entire ride
.. when a ride is opened the cache is also updated
at the same time.
.. added to slow things down on my developer PC as its
to fast to notice when I'm testing.
.. also left in an erroneous line clearing RideItem::isstale
which is also wrong as breaks separation of concerns
This is quite a big patch with lots of nasty interdependencies
all collected together but essentially it deprecates;
* Measures are no longer stored in SQL tables
* Zeo support has been dropped (they went bust)
To achieve this there are a large number of updates;
* Withings json is now cached in /cache and in the Athlete
class. So can be traversed in memory rather than SQL
* All "measures" on LTM have been removed and the only metric
left is "Athlete Weight" that cascades from withings to ride
"Weight" metadata value to athlete settings to a 80kg default
* RideCache is now refreshed, but only for metadata. This is needed
to cache the "Weight" metadata from rides when calculating weight.
* JsonRideFile parser is now re-entrant since it will run in parallel
during RideCache refreshes (using the QtConcurrent::map()
framework).
BUT NOTE
* This is about deprecating the Measures table more than anything
else. Functionally we are in pretty much the same place; just that
data is stored in a different place.
e.g. metric/imperial handling of weight is not fixed yet, no
metrics are in the cache yet, load/save of the cache is not done
so startup is slow etc.
.. fingerprint for range should not take into account the
start/end date as its irrelevant and will change
.. RideItem now responsible for refresh and status updating
on the rideitem
.. framework seems good now; only rides that need to be refreshed
will get asked for a refresh -- but need to look more closely
at how we derive 'Weight' for each rideitem now...
.. instead of making the caller keep rideitem up to date etc
we are going to move to it looking after itself.
.. the first part of this is to make it responsible for checking
if it is stale and computing fingerprints etc
.. the next part will be making it responsible for refreshing
the cached values.
One big thing too:
.. the fingerprint is now based upon the zone config that applies
for the date of the ride -- not all zone config. So if the config
changes but not for the date of this ride (e.g. set a new CP starting
from today) then the old data does not get marked as stale.
.. needed to clean RideItem a touch
.. needed to isolate intervals code as it has some
problems and breaks metricaggregator for normal
use.
.. found a bit of Context code in MainWindow.cpp (!!)
.. subtle, thin progress bar on tabview to notify
when background updates are in progress
.. background updating code created but does not
perform a refresh yet, just sleeps for 0.2s
.. to enable 'visibility' of the code use WANT_RIDECACHE
to the defines in gcconfig.pri
.. added /BAK subdir where all actvities .BAK files are stored
.. do not delete any original files in /imports /downloads when deleting
activity
.. copy deleted activity .JSON as .BAK into /BAK subfolder
.. adjust upgrade procedure to copy .BAK files to /BAK
# By Mark Liversedge
# Via Mark Liversedge
* 'master' of https://github.com/mtbkeith/GoldenCheetah:
Added RideCache
Introduce the RideCache
Turn off interval hover on leave
.. each metric now has an index (identifier) that can is numeric
starting at 0 and going up.
.. it can be used to offset into an array when we add a cache for
storing precomputed metrics.
.. they are in Athlete::zones() et al now
.. this refactor was missed in the 3.0 mainwindow
refactoring and is part of the prep to use RideItem
as an in memory cache instead of the old metricDB
.. so we can now call that instead of doing the conversion
and formatting all over the code !
NOTE: it still needs to be /called/ in the code, that change
will need to be applied everywhere a metric is displayed
to the user.
.. to fix long standing bug with saving whilst editing
a field. But still leaves a problem if exiting whilst
editing a field (which is a bit weird tbh).
.. its been there since the beginning at the heart of the code
as a registry of the rides (RideItem) and controlling the
selection of rides.
.. in v3.0 we stopped showing it, but it was still created and
then hidden immediately. But removing the 'spine' of the code
was seen as a step too far.
.. this is the first part of moving from SQL to a NoSQL cache
for ride metrics, metadata and measures -- RideItem is now
no longer inheriting from QTreeWidgetItem with all the issues
that brings.
.. since its right at the heart there are likely to be unforeseen
bugs as we go, especially since it affects the ride navigator.
.. add/delete has been tested a fair amount and should be reliable.