diff --git a/fittrackee/workouts/stats.py b/fittrackee/workouts/stats.py
index 80de9480b..de9a97a51 100644
--- a/fittrackee/workouts/stats.py
+++ b/fittrackee/workouts/stats.py
@@ -67,6 +67,8 @@ def get_workouts(
'nb_workouts': 0,
'total_distance': 0.0,
'total_duration': 0,
+ 'total_ascent': 0.0,
+ 'total_descent': 0.0,
}
workouts_list_by_sport[sport_id]['nb_workouts'] += 1
workouts_list_by_sport[sport_id]['total_distance'] += float(
@@ -75,6 +77,12 @@ def get_workouts(
workouts_list_by_sport[sport_id][
'total_duration'
] += convert_timedelta_to_integer(workout.moving)
+ workouts_list_by_sport[sport_id]['total_ascent'] += float(
+ workout.ascent
+ )
+ workouts_list_by_sport[sport_id]['total_descent'] += float(
+ workout.descent
+ )
# filter_type == 'by_time'
else:
@@ -110,6 +118,8 @@ def get_workouts(
'nb_workouts': 0,
'total_distance': 0.0,
'total_duration': 0,
+ 'total_ascent': 0.0,
+ 'total_descent': 0.0,
}
workouts_list_by_time[time_period][sport_id][
'nb_workouts'
@@ -119,8 +129,15 @@ def get_workouts(
] += float(workout.distance)
workouts_list_by_time[time_period][sport_id][
'total_duration'
- ] += convert_timedelta_to_integer(workout.moving)
-
+ ] += convert_timedelta_to_integer(workout.moving)
+ if workout.ascent:
+ workouts_list_by_time[time_period][sport_id][
+ 'total_ascent'
+ ] += float(workout.ascent / 1000)
+ if workout.descent:
+ workouts_list_by_time[time_period][sport_id][
+ 'total_descent'
+ ] += float(workout.descent / 1000)
return {
'status': 'success',
'data': {
diff --git a/fittrackee_client/src/components/Common/Stats/StatsChart.jsx b/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
index ca3678f16..1862b0d5f 100644
--- a/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
+++ b/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
@@ -53,6 +53,24 @@ export default class StatsCharts extends React.PureComponent {
/>
{t('statistics:duration')}
+
+
+ {workout.min_alt && workout.max_alt && (
+
+
+ {t('workouts:Min. altitude')}: {workout.min_alt}m
+
+ {t('workouts:Max. altitude')}: {workout.max_alt}m
+
+
+ )}
+ {workout.ascent && workout.descent && (
+
+
+ {t('workouts:Ascent')}: {workout.ascent}m
+
+ {t('workouts:Descent')}: {workout.descent}m
+
+ )}
diff --git a/fittrackee_client/src/components/Workouts/WorkoutsList.jsx b/fittrackee_client/src/components/Workouts/WorkoutsList.jsx
index 771fb68f5..745a1a479 100644
--- a/fittrackee_client/src/components/Workouts/WorkoutsList.jsx
+++ b/fittrackee_client/src/components/Workouts/WorkoutsList.jsx
@@ -21,6 +21,8 @@ export default class WorkoutsList extends React.PureComponent {
{t('workouts:Duration')} |
{t('workouts:Ave. speed')} |
{t('workouts:Max. speed')} |
+ {t('workouts:Ascent')} |
+ {t('workouts:Descent')} |
@@ -85,6 +87,18 @@ export default class WorkoutsList extends React.PureComponent {
{workout.max_speed} km/h
+
+
+ {t('workouts:Ascent')}
+
+ {workout.ascent} m
+ |
+
+
+ {t('workouts:Descent')}
+
+ {workout.descent} m
+ |
))}
diff --git a/fittrackee_client/src/locales/en/sports.json b/fittrackee_client/src/locales/en/sports.json
index b8e9bb783..59eb4974d 100644
--- a/fittrackee_client/src/locales/en/sports.json
+++ b/fittrackee_client/src/locales/en/sports.json
@@ -3,6 +3,11 @@
"Cycling (Transport)": "Cycling (Transport)",
"Hiking": "Hiking",
"Mountain Biking": "Mountain Biking",
+ "Mountain Biking (Electric)": "Mountain Biking (Electric)",
"Running": "Running",
- "Walking": "Walking"
+ "Walking": "Walking",
+ "Trail" : "Trail",
+ "Skiing (Alpine)" : "Skiing (Alpine)",
+ "Skiing (Cross Country)" : "Skiing (Cross Country)",
+ "Rowing" : "Rowing"
}
diff --git a/fittrackee_client/src/locales/en/statistics.json b/fittrackee_client/src/locales/en/statistics.json
index 04bb70111..1ef9b4202 100644
--- a/fittrackee_client/src/locales/en/statistics.json
+++ b/fittrackee_client/src/locales/en/statistics.json
@@ -2,6 +2,8 @@
"workouts": "workouts",
"distance": "distance",
"duration": "duration",
+ "ascent": "ascent",
+ "descent": "descent",
"month": "month",
"Statistics": "Statistics",
"year": "year",
diff --git a/fittrackee_client/src/locales/fr/sports.json b/fittrackee_client/src/locales/fr/sports.json
index 3cc6591a3..e2d7828c8 100644
--- a/fittrackee_client/src/locales/fr/sports.json
+++ b/fittrackee_client/src/locales/fr/sports.json
@@ -3,6 +3,11 @@
"Cycling (Transport)": "Vélo (Transport)",
"Hiking": "Randonnée",
"Mountain Biking": "VTT",
+ "Mountain Biking (Electric)": "VTT (Electrique)",
"Running": "Course",
- "Walking": "Marche"
+ "Walking": "Marche",
+ "Trail" : "Trail",
+ "Skiing (Alpine)" : "Ski (Alpin)",
+ "Skiing (Cross Country)" : "Ski (Randonnée)",
+ "Rowing" : "Aviron"
}
diff --git a/fittrackee_client/src/locales/fr/statistics.json b/fittrackee_client/src/locales/fr/statistics.json
index 28178e120..7a90dfc04 100644
--- a/fittrackee_client/src/locales/fr/statistics.json
+++ b/fittrackee_client/src/locales/fr/statistics.json
@@ -2,6 +2,8 @@
"workouts": "séances",
"distance": "distance",
"duration": "durée",
+ "ascent": "dénivelé+",
+ "descent": "dénivelé-",
"month": "mois",
"Statistics": "Statistiques",
"year": "année",
diff --git a/fittrackee_client/src/locales/fr/workouts.json b/fittrackee_client/src/locales/fr/workouts.json
index 782a4073a..ae510bb95 100644
--- a/fittrackee_client/src/locales/fr/workouts.json
+++ b/fittrackee_client/src/locales/fr/workouts.json
@@ -5,13 +5,13 @@
"Add a workout": "Ajouter une séance",
"Are you sure you want to delete this workout?": "Etes-vous sûr de vouloir supprimer cette séance ?",
"Ave. speed": "Vitesse moyenne",
- "Ascent": "Dénivelé positif",
+ "Ascent": "Dénivelé +",
"Average speed": "Vitesse moyenne",
"Chart": "Analyse",
"data from gpx, without any cleaning": "données issues du fichier gpx, sans correction",
"Date": "Date",
"Delete workout": "Supprimer l'séance",
- "Descent": "Dénivelé négatif",
+ "Descent": "Dénivelé -",
"Distance": "Distance",
"distance": "distance",
"Duration": "Durée",
diff --git a/fittrackee_client/src/utils/stats.js b/fittrackee_client/src/utils/stats.js
index 57fd83a81..441fd5ea3 100644
--- a/fittrackee_client/src/utils/stats.js
+++ b/fittrackee_client/src/utils/stats.js
@@ -39,6 +39,10 @@ export const formatValue = (displayedData, value) =>
? `${value.toFixed(2)} km`
: displayedData === 'duration'
? formatDuration(value)
+ : displayedData === 'ascent'
+ ? `${value.toFixed(2)} km`
+ : displayedData === 'descent'
+ ? `${value.toFixed(2)} km`
: value
const dateIncrement = (duration, day) => {
@@ -69,6 +73,8 @@ export const formatStats = (stats, sports, params, displayedSports, weekm) => {
const nbWorkoutsStats = []
const distanceStats = []
const durationStats = []
+ const ascentStats = []
+ const descentStats = []
for (
let day = startDate(params.duration, params.start, weekm);
@@ -83,6 +89,8 @@ export const formatStats = (stats, sports, params, displayedSports, weekm) => {
const dataNbWorkouts = { date: xAxis }
const dataDistance = { date: xAxis }
const dataDuration = { date: xAxis }
+ const dataAscent = { date: xAxis }
+ const dataDescent = { date: xAxis }
if (stats[date]) {
Object.keys(stats[date])
@@ -94,17 +102,23 @@ export const formatStats = (stats, sports, params, displayedSports, weekm) => {
dataNbWorkouts[sportLabel] = stats[date][sportId].nb_workouts
dataDistance[sportLabel] = stats[date][sportId].total_distance
dataDuration[sportLabel] = stats[date][sportId].total_duration
+ dataAscent[sportLabel] = stats[date][sportId].total_ascent
+ dataDescent[sportLabel] = stats[date][sportId].total_descent
return null
})
}
nbWorkoutsStats.push(dataNbWorkouts)
distanceStats.push(dataDistance)
durationStats.push(dataDuration)
+ ascentStats.push(dataAscent)
+ descentStats.push(dataDescent)
}
return {
workouts: nbWorkoutsStats,
distance: distanceStats,
duration: durationStats,
+ ascent: ascentStats,
+ descent: descentStats,
}
}
diff --git a/fittrackee_client/src/utils/workouts.js b/fittrackee_client/src/utils/workouts.js
index f9a977bf1..9bbdc5516 100644
--- a/fittrackee_client/src/utils/workouts.js
+++ b/fittrackee_client/src/utils/workouts.js
@@ -4,13 +4,17 @@ import togeojson from '@mapbox/togeojson'
import { getDateWithTZ } from './index'
export const workoutColors = [
- '#55a8a3',
- '#98C3A9',
- '#D0838A',
- '#ECC77E',
- '#926692',
- '#929292',
- '#428bca',
+ '#F94144',
+ '#F3722C',
+ '#F8961E',
+ '#F9844A',
+ '#F9C74F',
+ '#90BE6D',
+ '#43AA8B',
+ '#4D908E',
+ '#577590',
+ '#277DA1',
+ '#272DA1',
]
export const recordsLabels = [