diff --git a/mpwo_api/mpwo_api/activities/models.py b/mpwo_api/mpwo_api/activities/models.py index 951c2b07..ec0e7a90 100644 --- a/mpwo_api/mpwo_api/activities/models.py +++ b/mpwo_api/mpwo_api/activities/models.py @@ -204,7 +204,7 @@ class Activity(db.Model): record_types_columns = { 'AS': 'ave_speed', # 'Average speed' 'FD': 'distance', # 'Farthest Distance' - 'LD': 'duration', # 'Longest Duration' + 'LD': 'moving', # 'Longest Duration' 'MS': 'max_speed', # 'Max speed' } records = {} diff --git a/mpwo_api/mpwo_api/tests/conftest.py b/mpwo_api/mpwo_api/tests/conftest.py index 3e2503ac..c3a6516e 100644 --- a/mpwo_api/mpwo_api/tests/conftest.py +++ b/mpwo_api/mpwo_api/tests/conftest.py @@ -90,6 +90,7 @@ def activity_cycling_user_1(): ) activity.max_speed = 10 activity.ave_speed = 10 + activity.moving = activity.duration db.session.add(activity) db.session.commit() return activity diff --git a/mpwo_client/src/components/Activities/ActivityDisplay/ActivityDetails.jsx b/mpwo_client/src/components/Activities/ActivityDisplay/ActivityDetails.jsx index 91984efd..f3d19f85 100644 --- a/mpwo_client/src/components/Activities/ActivityDisplay/ActivityDetails.jsx +++ b/mpwo_client/src/components/Activities/ActivityDisplay/ActivityDetails.jsx @@ -2,6 +2,8 @@ import React from 'react' export default function ActivityDetails(props) { const { activity } = props + const withPauses = activity.pauses !== '0:00:00' && activity.pauses !== null + const recordLDexists = activity.records.find(r => r.record_type === 'LD') return (
@@ -10,18 +12,21 @@ export default function ActivityDetails(props) {
aria-hidden="true"
/>
Duration: {activity.duration}
- {activity.records.find(r => r.record_type === 'LD'
- ) && (
+ {withPauses && (
+
+ {' '}
+ (pauses: {activity.pauses})
+
+ Moving duration: {activity.moving}
+
+ )}
+ {recordLDexists && (
- )} {' '}
- {activity.pauses !== '0:00:00' &&
- activity.pauses !== null && (
- `(pauses: ${activity.pauses})`
)}
diff --git a/mpwo_client/src/components/Activities/ActivityDisplay/index.jsx b/mpwo_client/src/components/Activities/ActivityDisplay/index.jsx index 46188878..2b60be40 100644 --- a/mpwo_client/src/components/Activities/ActivityDisplay/index.jsx +++ b/mpwo_client/src/components/Activities/ActivityDisplay/index.jsx @@ -89,20 +89,22 @@ class ActivityDisplay extends React.Component {