Exiting isRun/isSwim are preserved and new isRide/isXtrain added.
Use them in DataFilter to provide isRide, isRun, isSwim and isXtrain
and in RideSummary for better filtering of activities in rides, runs
swims and xtrains.
Part 1 of #3280
.. Refresh model estimates when rides added, deleted, saved.
.. Lazy refresh will cancel any pending or running threads and
trigger a new one in 15 secs time.
.. This strategy allows us to call a lazy refresh even when importing
large number of rides, since the start will be delayed and cancelled
by the next ride added etc.
.. The thread stop() function is also called by the destructor to stop
when the user exits and avoiding delay/SEGV on exit.
.. new Estimator class to refresh model estimates in a thread.
.. localised all data access to the new class to resolve issues
with thread safety.
.. RideSummary and LTMPlot do not trigger refresh of the estimates
.. added a QMutex around access in Athlete::getPDEstimates and the
code in Estimator::run that updates them.
NOTE:
will still need a follow-up commit to resolve estimate refresh
e.g. after ride saved, or rides imported or rides downloaded from
a cloud service. This is a challenging problem since refreshes
need to be 'very lazy' to avoid wasted cycles.
Fixes#2820
.. at startup we ask the user for permission to share
.. once permission is granted the upload is performed and
re-done every year, so long as > 100 workouts have been
collected since the last time.
.. Will prepare and post data to an OpenData server running
in a background thread:
* will find servers from www.goldencheetah.org
* uses first server it finds that is running
* prepares and sends data
.. need to write the code to get explicit permission from
the user to do it, then send data when worthwhile.
.. thinking this is annually, but only if > 100 new workouts.
.. phew! this was a subtle bug.
.. the SpecialFields class tells the data filter what
type of thing each symbol equates to.
.. it was saying TSS was metadata not a metric.
.. this is becuase SpecialFields is setup before the
user metrics are loaded, so it only saw it as a
metadata field.
.. we now refresh context.specialFields after the
user metrics are loaded. So this will not just
fix TSS but ALL user metrics that have an override
defined in metadata.
.. as usermetrics that alias the old metric name to
the renamed metric.
.. need to follow up with restrictions on the use of
the compatibility metrics.
.. Gui notifications of background activity
.. a small notification area at the bottom of the analysis
sidebar shows checking and download status.
.. also fixed up the ride list to not select them, since that
is irritating if your in the middle of doing something.
.. initial plumbing to get the auto downloader integrated
into context, athlete and ridecache refresh.
.. part 2 will need to perform the download functions
.. part 3 to add the GUI / notification of progress
.. full wizard now done, will write appsettings.
.. need to now look at how OAuth can be call mid-config as
a refactor if OAuthDialog in part 2
.. need to also look at how folder selection can be called using
"in-progress" config in part 3
.. need to tidy up special topics in Part 4, such as google drive
id and todays plan handling coach/athlete selection.
... in addition to DateTime in the .json File name (which is in local Time), also check for duplicates using UTC from RideCache to avoid duplicate imports if user changes his PC TimeZone (e.g. when travelling)
... the problem e.g. occurs in Autoimport where the same files would be imported again, if the PC TimeZone changes
.. a data processor can now be configured to run on save
.. in addition, the data processor is now passed the operation
that is triggering it: "Manual", "ADD", "UPDATE", "DELETE",
"IMPORT".
.. a new data processor has been added to write a JSON file to
the snippet directory (added to the athlete structure).
.. this is so we can output a snippet every time an activity is
added, updated or deleted (i.e. runs "on save").
.. these JSON snippets can be used to update external datastores
where coaches use other analytic software but don't want to
manually sync GC changes with there external stores.
Adds isMetricRelevantForRides(specification, metric) to RideCache
to check if a metric isRelevant for some of the activities passing
the specification
Also reduces from 3 to 1 the calls to getRideTypeCounts