Commit Graph

42 Commits

Author SHA1 Message Date
Joachim Kohlhammer
f6d4f6a6cb Using "actual activity" instead of "completed activity" (#4813)
To match  #4811
2026-01-24 07:22:25 -03:00
Joachim Kohlhammer
3e8c6fe047 Updating power values of planned activities with linked workouts (#4799)
* Updating power values of workout based planned activities when they
  fall into a timerange with different CP
* Triggers:
  * CP configuration changes (future activities only)
  * planned activities are moved (calendar)
  * schedules are repeated (calendar)
  * rest days are inserted or removed (calendar)
* Additional: Typo in Calendar (show in train _n_ode -> mode)
2026-01-13 01:42:43 -03:00
Joachim Kohlhammer
3a995f768e Linking planned and completed activities (#4772)
* Bidirectional linking of planned and completed activities via field "Linked Filename"
* Convenience functions in RideCache, taking care of updating all relations
  * link activities
  * unlink activities
  * move activities
  * copy planned activities
  * batch copy planned activities
  * shift planned activities
* Calendar
  * Visual hints to show whether an activity is linked (bar on right side)
  * Options to link, unlink, jump to linked activity
  * Option to save an activity
  * Visual hint indicating unsaved changes in an activity (italic font)
  * Deleting activities clears the link
* Agenda: Hiding completed / linked activities
* Repeat Schedule: Clearing the link in copied entries
* RideImportWizard: Autolinking new activities if a planned counterpart exists
* Stricter consistency handling of linked activities
Additional:
* highlighting linked activities when clicking in calendar
* linked() datafilter access function (similar to filename())
* New dialog to link planned and completed activities
* Centralized the calendar context menus (only one location to maintain them for all views)
* Restructured the entries of all calendar context menus
2026-01-05 15:58:59 -03:00
Paul Johnson
c67d913f11 Deprecate QT5 support (#4751)
* Remove Qt5 Compatibility
* Remove QT compiler directives < QT6.5.3, set QT6.5.3 as minimum GC version
* Remove references to QT5 Video
Fixes #4750
2025-12-18 10:37:55 -03:00
Paul Johnson
9c6d361dab Single instance of SpecialFields (#4660)
i) Ensure that SpecialFields (and SepcialTabs for consistency) are singletons, and GlobalContext & RideCache can reload its configuration.
ii) GlobalContext not longer holds a SpecialFields parameter, SpecialFields is a single globally available object.
ii) The unused model and accessor have been removed.
iii) The unused and unimplemented fieldType() and associated enum have been removed.
iv) All SpecialFields accessor functions now use const QString& parameter types.
2025-06-26 14:47:56 -03:00
Alejandro Martinez
cf71437d79 Qt6: utf8 for QTextStream is the default
Fixes #3953
2024-01-12 11:28:30 -03:00
Andreas Buhr
d733099a6f Replace qStableSort by std::stable_sort (#3936)
qStableSort is deprecated. This patch replaces all usages by
std::stable_sort.
2024-01-09 16:44:03 -03:00
Paul Johnson
add0f301e9 Batch processing (#4226)
Batch Processing - Delete, Data Processors & Export

Extension of Batch Export dialog to include other operation on multiple activities:
- run data processor (Builtin or Python)
- delete (after confirmation)

Co-authored-by: Alejandro Martinez <amtriathlon@gmail.com>
2023-03-17 13:01:48 -03:00
Alejandro Martinez
bfa4b4b977 DataFilter - Metric aggretation honors AggregateZero and Count
When computing metric averages
2023-01-16 12:54:29 -03:00
Alejandro Martinez
2c3eabdd8b RideCache - Fix refresh to include the oldest activity
This boundary error provokes the cache entry for the oldest
activity don't be refreshed on full cache refresh, only
when the activity is imported or opened (s.t. selecting it
in Activities View).
For most users this may be uneventfull, but if the oldest
activity becomes dirty, a full cache will happend on each
following start, until the oldest activity is opened and
it may explain the behavior reported ocasionally at the forum
and recently in #4297
2022-12-10 10:14:44 -03:00
Mark Liversedge
84eceebd00 Fix metric refresh SEGV
.. when athlete has < 10 activies modulo 0 causes arithmetic
   operation crash (divide by zero).
2022-08-17 23:20:42 +01:00
Mark Liversedge
e602ba4d31 Better metric refresh progress updates
.. precious commit has a significant improvement in performance
   since it reduces total CPU activity not related to metric
   calculation dramatically.

.. this commit is a minor tweak to ensure updates are shown
   relative to the number of activities- so instead of giving
   visual feedback after every 100 activities we give feedback
   after every 10% of the activies are processed.
2022-06-25 09:33:12 +01:00
Alejandro Martinez
4345c97960 RideCache refresh - avoid overloading the GUI event loop
When using concurrent map QFutureWatcher flow controls progress
notifications, this commit implements a basic version sending
1/100 refresh updates.
2022-06-24 11:58:36 -03:00
Mark Liversedge
9d9ad753f3 Metric refresh no longer uses QtConcurrent::map()
.. since Qt5.15 QtConcurrent::map() will use all available
   worker threads in the global thread pool. And this causes
   a deadlock in the GUI since QGraphicsView uses threads to
   manage updates.

.. we now manage the metric refresh via RideCacheRefreshThread
   and use at most 50% of the overall threads available in the
   global thread pool.

.. Have tested obvious triggers such as metric schema updates
   and user metrics being changed, but more testing is needed.

Fixes #3611
2022-06-12 17:00:01 +01:00
Alejandro Martinez
380dc47ac7 Generalize HrZones for any sport
All sports defined as values for Sport metadata field can have
specifics HR Zones and default to Bike zones otherwise.
Similar to current HR zones for Run.
Part 2 of #3280
2021-05-25 20:28:15 -03:00
Mark Liversedge
9a0b6e0bc7 qSort is deprecated, use std::sort
.. mostly straight replacement as qt5 containers are templated
   and qSort semantics are the same as std::sort

.. prepping for Qt6.2 which is due late 2021.

Signed-off-by: Mark Liversedge <liversedge@gmail.com>
2021-05-21 11:30:46 +01:00
Ale Martinez
cb37db2281 Export to CSV with UTF8 and ISO date format
For broader support of translations and date formats
Fixes #3613
2020-11-28 17:56:06 -03:00
Mark Liversedge
fbd095a2d4 Split Global and Athlete configuration
.. Global settings (themes, metadata etc) are now maintained
   in the config dialog as in the past, whilst athlete settings
   (such as zones, measures etc) are now maintained in a new
   config dialog accessible from the athlete view (gear icon).

.. Config changes are communicated via two signals;
   * Context::configChanged(qint32)
   * GlobalContext::configChanged(qint32)

   Crucially, all global context signals are cascaded through
   the athlete contexts-- so athlete specific widgets only
   need to connect to the athlete context signal (and will get
   athlete and global config change notifications).

   Whilst global widgets such as the sidebar and mainwindow
   need only connect to the globalcontext signal since they
   are not interested in athlete specific details.

[publish binaries]
2020-08-22 11:36:24 +01:00
Mark Liversedge
80d7eed382 RideMetadata and friends moved to GlobalContext
.. Ride metadata was associated to the athlete rather than a
   global setting. This was a serious design flaw since user
   metrics can reference metadata.

.. A global metadata.xml file is generated on startup by
   consolidating all athlete level settings into a single
   configuration.

.. Other dependencies were also moved; SpecialFields,
   ColorEngine and UseMetricUnits.

.. We should now be able to remove athlete configuration
   from the config dialog and put it into the athlete view
   instead.

   This will also fixe a long standing issue with
   configuring athlete settings when multiple athletes are
   open.

[publish binaries]
2020-08-21 19:01:37 +01:00
Mark Liversedge
9bb1f3434d Fixup RideCache Load in Thread
.. move thread based load of ridecache into ridecache, this fixes a
   serious regression.

.. previously because the ridecache was created in a thread it could
   not attach to the events from the main gui event loop.

.. we now load the RideDB.json file in a worker thread, but the
   ridecache, and its items are created in the main thread.
2020-08-14 10:25:21 +01:00
Mark Liversedge
1d9f570ed8 Introduce a Global Context
.. GlobalContext::context() provides a global context that is not
   tied to an athlete or MainWindow.

.. At present it just offers signals for config changes but will
   likely see more context move across as the application preferences
   and athlete configuration are separated as we enhance support
   for multiple athletes.
2020-08-11 22:16:13 +01:00
Mark Liversedge
7a4be49492 RideCache load performance improvement
.. string manipulation using raw C since its simple character
   replacement, halved time over previous approach.

.. lookup rideitem in ridecache via binary search (lower_bound)
   rather than serial. Minor speed up.

.. Overall, loading should be noticeably quicker for most users.
2020-07-30 15:44:02 +01:00
Ale Martinez
42fa49c50f Add sport field to RideItem/RideDB as primary field
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
2020-04-06 19:13:43 -03:00
Mark Liversedge
f8af6334fb Estimator lazy refresh
.. 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.
2018-04-01 14:46:30 +01:00
Mark Liversedge
6e6db666c5 Refactor PD Estimates fix numerous SEGV
.. 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
2018-04-01 12:41:56 +01:00
Mark Liversedge
0860fe771f OpenData prompt for permission and post
.. 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.
2018-03-18 19:51:45 +00:00
Mark Liversedge
afff2c92bc OpenData new class to post to service
.. 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.
2018-03-18 17:05:46 +00:00
Mark Liversedge
6bed8fc55d Fix compat metric TSS zero value in DataFilter
.. 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.
2018-03-05 12:05:41 +00:00
Mark Liversedge
a7e17e378c Create TrainingPeaks Compatibility Metrics
.. 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.
2018-02-17 18:49:14 +00:00
Ale Martinez
b99e8f54f8 Fixes MeanSquareRoot aggregation in RideCache
In LTMPlot it is Ok
Fixes #2762
2018-01-31 20:52:20 -03:00
Mark Liversedge
70593976cb Cloud Auto Download - 3 of 3
.. 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.
2017-04-15 17:52:04 +01:00
Mark Liversedge
ccbba3e0a2 Cloud Auto Download - 1 of 3
.. 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
2017-04-14 15:40:49 +01:00
Mark Liversedge
bf8d8a8f95 Cloud Refactor - Add Account Wizard Part 1 of 4
.. 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.
2017-03-31 17:34:53 +01:00
Leif Warland
16e2451e90 Added HRV metric 2017-02-28 14:18:58 +01:00
Joern
dd88dd909d RideImport
... 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
2017-02-14 22:02:50 +03:00
Mark Liversedge
a38696e25d Data Processor 'On Save' and Snippets
.. 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.
2016-11-12 22:36:44 +00:00
Alejandro Martinez
d1ed2d7b51 Trends RideSummary Shows only Relevant Metrics on activities lists
Avoiding non relevant metrics for each sport allows to
show more relevant metrics on the available columns.
2016-10-10 10:59:53 -03:00
Alejandro Martinez
ddcbd287c7 Speedup isMetricRelevantForRides method
Shortcut or is enough
2016-10-08 09:50:26 -03:00
Alejandro Martinez
ca262a28ce Skip non relevant metrics for RideSummary in Trends view
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
2016-10-07 21:17:43 -03:00
Alejandro Martinez
f4fac0b3c3 Fixed removal of planned workouts
Rename failed due to wrong directory
2016-03-26 11:32:31 -03:00
Mark Liversedge
01d8ed9c09 Thread Safety for PD Estimates (SEGV)
.. we refresh in a thread so need to protect
   access to them via a QMutex.
2016-03-24 20:03:45 +00:00
Mark Liversedge
fbf970fa7e Move RideCache to Core
.. it was in FileIO
2016-02-25 16:37:12 +00:00