Commit Graph

80 Commits

Author SHA1 Message Date
Mark Liversedge
f39214cbe8 RideItem recompute NP etal when data changes
.. just before signalling plots to redraw
2014-12-31 15:30:06 +00:00
Mark Liversedge
56b5114af7 Update Note coloring during RideItem::checkStale()
.. it takes as long to check if its out of date
   as it does to just change it !

.. would be pointless to kick of a refresh just for this.
2014-12-31 14:06:21 +00:00
Mark Liversedge
9a17258f44 Notify config changed - NOTECOLOR, FIELDS
.. notify if the metadata configuration has been changed

.. also snuck in a change to take hysteresis out of the
   power zones fingerprint - it should not have been there
2014-12-31 13:18:34 +00:00
Mark Liversedge
254f463760 Introduce Context::rideChanged() signal
.. to let charts etc know that the *current* ride has
   changed and will need to be replotted

.. the editor / dataprocessor functions have also been
   integrated into the RideItem to notify the change

.. there is a qDebug() in RideCache in lieu of updating
   all the charts to refresh on this signal.
2014-12-29 16:03:02 +00:00
Mark Liversedge
e7399ba4f2 Lucene empty index optimisation
.. rather than check if lucene index contains every ride
   upon startup just force a rebuild of the index is missing.

.. if the index gets out of sync its because people are copying
   data and so they should delete the index when they do so
   to make sure it stays in sync
2014-12-29 10:24:10 +00:00
Mark Liversedge
98720f099e Use C++ <cmath> not C <math.h>
.. it clashes, and also its deprecated for C++ sources
2014-12-25 20:38:18 +00:00
Mark Liversedge
9c1f110d3a Add Lucene Index if missing
.. as well as checking the metaCRC RideItem will add the
   ride to the lucene index if it is missing.
2014-12-25 19:43:50 +00:00
Mark Liversedge
995d5fb4f1 Lucene search index migrate to RideItem
.. now when we refresh a ride item it will also
   update the lucene index, but only if the texts
   have changed since we last updated it.
2014-12-25 16:37:42 +00:00
Mark Liversedge
7ad2bda418 RideFileCache now refreshed in RideItem
.. and fixed sort order problem
2014-12-25 13:59:38 +00:00
Mark Liversedge
44aea09d97 Deprecate SQL metricDB
.. removes across the code base

.. need to fixup RideFileCache and Lucene refresh
   within the RideItem/RideCache framework, they will
   NOT be refreshed at present

.. need to look at how charts get refreshed on data
   changes now RideItem provides a more granular
   mechanism (look for XXXREFRESH in code)

.. New Intervals code will definitely NOT compile
   and needs to be redesigned/reimplemented to fit
   in with the ride cache
2014-12-24 20:24:34 +00:00
Mark Liversedge
c9278b9fef RideItem destructor
.. no memory leaks here !
2014-12-21 22:03:36 +00:00
Mark Liversedge
fdf3760dee Migrate CRC from DBAccess to RideFile
.. and wipe a few more SummaryMetric references
2014-12-19 19:30:18 +00:00
Mark Liversedge
8a462b43fe Migrate RideSummary (Compare) to use RideCache
.. ride summary window is now free of metricDB

PHEW!
2014-12-17 18:36:49 +00:00
Mark Liversedge
698a598927 Migrate RideSummary (DateRange) to use RideCache
.. but compare mode still uses metricDB

.. and the code is still in need of tidy up
2014-12-17 17:03:45 +00:00
Mark Liversedge
72fadc23ac Migrate Histogram to use RideCache
.. and specification, but only when plotting a metric
   over a date range.
2014-12-17 11:58:58 +00:00
Mark Liversedge
b105204b66 Add RideFileCache to RideItem
.. so available for current ride

.. and refreshed() when notifyDataChanged() is called

.. but not many classes call it!

.. we are moving to having the filecache read from the
   RideCache rather than straight from disk so we have an
   in-memory and persisted version.
2014-12-14 15:35:53 +00:00
Mark Liversedge
3a1c7309f3 Migrate refreshPDEstimates
.. from MetricAggregator to RideCache

.. will need to wipe out your rideDB.json before
   running to ensure present is set correctly.
2014-12-12 14:56:48 +00:00
Mark Liversedge
e97045703a Add RideItem ::color, ::isRun and ::present
.. as primary fields, and also load/save to cache.
2014-12-12 14:08:11 +00:00
Mark Liversedge
4b3abd3787 Migrate getRideMetrics() and friends
.. from DBAccess to RideCache

.. and also SummaryMetrics::getForSymbol() now available in
   RideItem to access the precomputed metrics for a single
   ride.
2014-12-12 12:53:40 +00:00
Mark Liversedge
5d13307f96 RideCache::load()
.. loads the cache/rideDB.json back on startup to avoid
   any refresh of metrics etc

.. uses a lex/bison JSON parser, not because of performance
   since its only run one at startup, but because;

   * QtJSON support is only available in QT5
   * mvjson uses a DOM model that creates a memory overhead
   * the existing bison/lex parser works well and is easy to
     use as a template for this

We now have a good mechanism for metrics and metadata refresh,
cache and recovery so can look at using it in the charts and
the ride navigator next !
2014-12-10 19:34:09 +00:00
Mark Liversedge
e5ca8ae880 RideCache compute metrics
.. 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.
2014-12-08 19:38:01 +00:00
Mark Liversedge
22584288ca Ridecace Measures deprecated from SQLite
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.
2014-12-08 16:48:58 +00:00
Mark Liversedge
dc5beca607 RideCache / RideItem fixups
.. 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...
2014-12-07 00:11:44 +00:00
Mark Liversedge
aba0e5b933 RideItem separation of concerns
.. 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.
2014-12-06 08:48:34 +00:00
Mark Liversedge
5c9da4de37 RideCache Framework Update
.. 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 (!!)
2014-12-05 23:06:28 +00:00
Mark Liversedge
282ecdef63 RideCache Background Refresh Framework
.. 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
2014-12-05 20:08:32 +00:00
Mark Liversedge
a61c1e3217 Introduce the RideCache
.. just a refactor of ridelist out of Athlete for now
   but will shortly be refreshing in background and
   loading and saving to rideDB.json
2014-12-05 15:30:54 +00:00
Mark Liversedge
aea550c267 Remove Zones from RideItem
.. 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
2014-12-03 19:06:07 +00:00
Mark Liversedge
f148481ada Finally remove Old Ride list QTreeWidget !
.. 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.
2014-12-03 10:33:50 +00:00
Mark Liversedge
b12d966aef Fix Merge Wizard Saving Bug
.. RideItem() is horrible
.. but it kinda works so just work around it
2014-11-25 15:53:41 +00:00
Mark Liversedge
d56bd21156 Updated Merge Tool Part 2c (last part)
.. UX to adjust now complete.

We may need to tidy a few things up, but this
is now good for working with the Moxy at the
very least.
2014-11-14 18:45:40 +00:00
Mark Liversedge
f80427d98e Updated Merge Tool Part 2a of 2a/b
.. page flow and join sorted

.. committing before resolving the merging code
   - analyse() to identify offsets
   - combine() to merge into a working copy
   - ux for sliding offsets on a fullplot

.. next commit will complete this update to the
   merge tool

NOTE: MERGE IS NOT CURRENTLY WORKING SO PLEASE
      DO NOT USE IT !!!!
2014-11-13 20:02:25 +00:00
Damien
08987d693a IntervalView: Add a new intervals View 2014-11-12 22:29:40 +01:00
Mark Liversedge
c698ab4ebf Default Weight Refresh
.. if the default athlete weight is changed then all ride
   metrics need to be recalculated to reflect the new default

.. any cached values need to be invalidated so interval metrics
   reflect the new weight (if needed)

It would be better for users to maintain weight either against the
ride in the "Weight" field, or via Withings !
2014-07-26 11:38:00 +01:00
Joern
3e62f8e139 Some more AM/APs
... some more AP/AM changes (hopefulyl the last ones)
... Setttings.h - the GC_DATETIMEFORMAT constant is not used anywhere
(old usages are de-activated)
2014-06-30 14:21:19 +02:00
Mark Liversedge
a2a962120c A lot less assert
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.
2013-08-04 11:06:07 +01:00
Mark Liversedge
bc4a6d978e Introduce AnalysisSidebar widget
Moving the code intertwined into MainWindow for
the analysis view sidebar; activity list, intervals
and calendar into a new AnalysisSidebar class.

                WARNING!

This is a work in progress checkpoint commit
as the sidebar menus and context menus have
not yet been migrated out -- this will be done
in the next commit or two.
2013-07-15 22:24:31 +01:00
Mark Liversedge
05f1d577db Refactor MainWindow Part 2 of 5
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
2013-07-11 14:02:02 +01:00
Mark Liversedge
e407237ac0 MainWindow Refactor Part 1 of 5
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.
2013-07-07 15:50:28 +01:00
Mark Liversedge
cd2fca9346 Code Cleanup: Remove #if 0 code
As a personal habit I tend to use the C pre-processor to
comment out code blocks I don't want to remove. This is in
case the code will be required in the future.

I think it is now safe to say the code commented out is not
required -- most of it is legacy and marks the transition from
earlier designs or legacy code.

I've done this in one big commit since in theory it has no
functional change, and in future can look in this commit for any
code we may want to reinstate.
2013-02-11 15:00:00 +00:00
Mark Liversedge
d7ec43633f Code Cleanup: Valgrind Memory
Not sure why, but setting the text on a treewidget item seems to
cost a lot of memory. So we don't bother since it is never used.

In general the valgrind output is ok, quite surprised. There are
very few non-widget items that are alloced but never free'd in the
GC code.
2013-02-11 11:32:23 +00:00
Mark Liversedge
1baefa0e2f Code Cleanup: Notes deprecated
.. some vestiges from the old notes file.
.. fixes a significant memory leak in MainWindow too.
2013-02-11 09:35:03 +00:00
Mark Liversedge
8698aaa76b Reintroduce Heartrate Zone Summary on RideSummary Window
The refactoring of the summary window to use metricDB and the
introduction of HR zone config in options removed (temporarily)
the table on ride summary.

This patch re-introduces it.
2011-04-09 14:08:28 +01:00
Mark Liversedge
3aba7dd788 Inital V3 Branch 2010-12-30 17:35:23 +00:00
Mark Liversedge
a29109343f Fix CSV parser and more checks for NULL ride
The CSV ride parser now checks for empty rides and returns
a NULL ride if there are no samples. In addition, the rideEditor
tries to set editorData even if the ride is NULL. Lastly, the
RideItem code for lazy reads of RideFile data didn't check for
NULL values (!).
2010-11-27 21:52:02 +00:00
Damien GRAUSER
830e4efd3d HR Zones and TRIMP Metrics
This patch introduces new functionality for working with
Heartrate based data.

* HR Zones can be defined, from Resting, Maximum and Lactate HR
* TRIMP metrics are calculated; TRIMP, TRIMP100 and Zonal TRIMP
* TRIMP metrics can be used to drive the PMC
* Time In Zone metrics for HR have been added
* Histogram window will now work with Power/HR zones
* User Settings have been added to record gender, weight and others
* RideFile has a new tag "Athlete" which is set to the athlete name

Fixes #140
2010-10-31 18:08:48 +00:00
Mark Liversedge
cd3bbc4e64 Ride editor and tools
A new tab 'Editor' for manually editing ride file data points and
associated menu options under 'Tools' for fixing spikes, gaps, GPS
errors and adjusting torque values. A revert to saved ride option
is also included to 'undo' all changes.

The ride editor supports undo/redo as well as cut and paste and
"paste special" (to append points or swap columns/overwrite
selected data series). The editor also supports search and will
automatically highlight anomalous data.

When a file is saved, the changes are recorded in a new metadata
special field called "Change History" which can be added as a
Textbox in the metadata config.

The data processors can be run manually or automatically when a
ride is opened - these are configured on the ride data tab in
the config pane.

Significant changes have been introduced in the codebase, the most
significant of which are; a RideFileCommand class for modifying
ride data has been introduced (as a member of RideFile) and the
RideItem class is now a QObject as well as QTreeWidgetItem to
enable signalling. The Ride Editor uses a RideFileTableModel that
can be re-used in other parts of the code. LTMoutliers class has been
introduced in support of anomaly detection in the editor (which
highlights anomalies with a wiggly red line).

Fixes #103.
2010-07-17 14:33:39 +01:00
Mark Liversedge
4e7e6cfb3a Honour RideFile::startTime
When saving the value of startTime should be checked to see
if the filename/notes need to be renamed. In addition, RideItem
now allows the startTime to be modified and reflected in the
ride list. When importing .gc ridefiles the file is serialized
with the correct startTime if the user edited it during import.
2010-03-25 09:16:28 -07:00
Sean Rhea
fa843db0ab figure out zoneRange from RideFile::startTime 2009-12-22 15:40:30 -05:00
Sean Rhea
ef200085a8 compute metrics in RideMetric
Move the logic for how to compute RideMetrics from a RideFile, including
dependency tracking, out of RideItem and into RideMetric.  I'm going to start
using them for intervals as well as rides, and I don't want to construct a
RideItem for each interval.  It also seems more natural here.  For
performance, RideItem still caches the computed metrics for a RideFile.
2009-12-22 15:23:02 -05:00