-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Altitude series will use imperial system correctly (#9)
New "altitude" and "corrected-altitude" series now track altitude in the selected measurement unit (meters or feet), the "alt" and "calt" series remain in meters only, for other calculations. This makes the elevation plot use the correct values when the user has the Imperial units selected.
- Loading branch information
Showing
9 changed files
with
110 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
;;; metrics.rkt -- calculate aggregate metrics for activities | ||
|
||
;; This file is part of ActivityLog2, an fitness activity tracker | ||
;; Copyright (C) 2016, 2018 Alex Harsányi <[email protected]> | ||
;; Copyright (C) 2016, 2018, 2022 Alex Harsányi <[email protected]> | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify it | ||
;; under the terms of the GNU General Public License as published by the Free | ||
|
@@ -408,7 +408,7 @@ | |
(define (scatter/jsexpr df series1 series2) | ||
|
||
(define is-lap-swim? (df-get-property df 'is-lap-swim?)) | ||
|
||
(define (extract) | ||
(if (df-contains? df series1 series2) | ||
(df-select* df series1 series2 #:filter valid-only) | ||
|
@@ -778,6 +778,8 @@ select X.session_id | |
(clear-saved-metrics-for-series "pace") | ||
(clear-saved-metrics-for-series "speed") | ||
(clear-saved-metrics-for-series "stride") | ||
(clear-saved-metrics-for-series "altitude") | ||
(clear-saved-metrics-for-series "corrected-altitude") | ||
;; (clear-saved-metrics-for-series "alt") | ||
;; (clear-saved-metrics-for-series "calt") | ||
;; (clear-saved-metrics-for-series "vosc") | ||
|
@@ -867,4 +869,3 @@ select X.session_id | |
(aggregate-scatter-bounds (-> aggregate-scatter/c number? number? bounds/c)) | ||
(aggregate-scatter-slr (-> aggregate-scatter/c (or/c #f slr?))) | ||
(clear-metrics-cache (-> any/c))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
;; built into the application (like heart rate or power). | ||
;; | ||
;; This file is part of ActivityLog2, an fitness activity tracker | ||
;; Copyright (C) 2015, 2018, 2020, 2021 Alex Harsányi <[email protected]> | ||
;; Copyright (C) 2015, 2018, 2020, 2021, 2022 Alex Harsányi <[email protected]> | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify it | ||
;; under the terms of the GNU General Public License as published by the Free | ||
|
@@ -437,16 +437,18 @@ | |
(if (eq? (al-pref-measurement-system) 'metric) | ||
"Elevation (m)" "Elevation (ft)")) | ||
(define/override (should-filter?) #f) | ||
(define/override (series-name) "alt") | ||
(define/override (series-name) "altitude") | ||
(define/override (name) "Elevation") | ||
(define/override (fractional-digits) 1) | ||
;; Don't replace missing values with anything, strip them out. | ||
(define/override (missing-value) #f) | ||
(define/override (value-formatter sport (sid #f) #:show-unit-label? (label? #f)) | ||
(lambda (v) | ||
(vertical-distance->string v label?))) | ||
(define v1 (convert-vertical-distance->m v)) | ||
(vertical-distance->string v1 label?))) | ||
))) | ||
(register-series-metadata axis-elevation) | ||
(register-series-metadata axis-elevation #:series-name "alt") | ||
(provide axis-elevation) | ||
|
||
|
||
|
@@ -458,16 +460,18 @@ | |
(if (eq? (al-pref-measurement-system) 'metric) | ||
"Elevation (m)" "Elevation (ft)")) | ||
(define/override (should-filter?) #f) | ||
(define/override (series-name) "calt") | ||
(define/override (series-name) "corrected-altitude") | ||
(define/override (name) "Elevation") | ||
(define/override (fractional-digits) 1) | ||
;; Don't replace missing values with anything, strip them out. | ||
(define/override (missing-value) #f) | ||
(define/override (value-formatter sport (sid #f) #:show-unit-label? (label? #f)) | ||
(lambda (v) | ||
(vertical-distance->string v label?))) | ||
(define v1 (convert-vertical-distance->m v)) | ||
(vertical-distance->string v1 label?))) | ||
))) | ||
(register-series-metadata axis-corrected-elevation) | ||
(register-series-metadata axis-corrected-elevation #:series-name "calt") | ||
(provide axis-corrected-elevation) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
;; series-metadata.rkt --meta data about data series in session data frames | ||
;; | ||
;; This file is part of ActivityLog2 -- https://github.com/alex-hhh/ActivityLog2 | ||
;; Copyright (c) 2018, 2019, 2020, 2021 Alex Harsányi <[email protected]> | ||
;; Copyright (c) 2018, 2019, 2020, 2021, 2022 Alex Harsányi <[email protected]> | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify it | ||
;; under the terms of the GNU General Public License as published by the Free | ||
|
@@ -156,22 +156,24 @@ | |
(define the-metadata-registry (make-hash)) | ||
(define the-swim-metadata-registry (make-hash)) | ||
|
||
(define (register-series-metadata m (is-lap-swimming? #f)) | ||
(define sn (send m series-name)) | ||
(define (register-series-metadata m | ||
(is-lap-swimming? #f) | ||
#:series-name (sn (send m series-name))) | ||
(define registry (if is-lap-swimming? | ||
the-swim-metadata-registry | ||
the-metadata-registry)) | ||
(when (hash-ref registry sn #f) | ||
(dbglog "register-series-metadata: overriding metadata for ~a" sn)) | ||
(hash-set! registry (send m series-name) m) | ||
(hash-set! registry sn m) | ||
(void)) | ||
|
||
(define (unregister-series-metadata m (is-lap-swimming? #f)) | ||
(define sn (send m series-name)) | ||
(define (unregister-series-metadata | ||
m (is-lap-swimming? #f) | ||
#:series-name (sn (send m series-name))) | ||
(define registry (if is-lap-swimming? | ||
the-swim-metadata-registry | ||
the-metadata-registry)) | ||
(hash-remove! registry (send m series-name)) | ||
(hash-remove! registry sn) | ||
(void)) | ||
|
||
(define (find-series-metadata series-name (is-lap-swimming? #f)) | ||
|
@@ -192,6 +194,12 @@ | |
(provide series-metadata%) | ||
|
||
(provide/contract | ||
(register-series-metadata (->* ((is-a?/c series-metadata%)) (boolean?) void?)) | ||
(unregister-series-metadata (->* ((is-a?/c series-metadata%)) (boolean?) void?)) | ||
(find-series-metadata (->* (string?) (boolean?) (is-a?/c series-metadata%)))) | ||
(register-series-metadata (->* ((is-a?/c series-metadata%)) | ||
(boolean? #:series-name string?) | ||
void?)) | ||
(unregister-series-metadata (->* ((is-a?/c series-metadata%)) | ||
(boolean? #:series-name string?) | ||
void?)) | ||
(find-series-metadata (->* (string?) | ||
(boolean?) | ||
(is-a?/c series-metadata%)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.