Skip to content

Commit 232512a

Browse files
committed
API & Client - display if missing elevations have been updated
1 parent f90d6aa commit 232512a

File tree

11 files changed

+74
-21
lines changed

11 files changed

+74
-21
lines changed

fittrackee/tests/workouts/test_workouts_model.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def test_it_serializes_workout_without_file(
138138
"max_power": None,
139139
"max_speed": workout.max_speed,
140140
"min_alt": None,
141+
"missing_elevations_processing": (
142+
workout.missing_elevations_processing
143+
),
141144
"modification_date": None,
142145
"moving": str(workout.moving),
143146
"next_workout": None,
@@ -200,6 +203,9 @@ def test_it_serializes_workout_without_file_and_with_ascent_and_descent(
200203
"max_power": None,
201204
"max_speed": workout.max_speed,
202205
"min_alt": None,
206+
"missing_elevations_processing": (
207+
workout.missing_elevations_processing
208+
),
203209
"modification_date": workout.modification_date,
204210
"moving": str(workout.moving),
205211
"next_workout": None,
@@ -271,6 +277,9 @@ def test_it_serializes_workout_with_file_for_cycling_and_geometry(
271277
"max_power": workout.max_power,
272278
"max_speed": float(workout.max_speed), # type: ignore[arg-type]
273279
"min_alt": float(workout.min_alt), # type: ignore[arg-type]
280+
"missing_elevations_processing": (
281+
workout.missing_elevations_processing
282+
),
274283
"modification_date": workout.modification_date,
275284
"moving": str(workout.moving),
276285
"next_workout": None,
@@ -347,6 +356,9 @@ def test_it_serializes_workout_with_file_for_outdoor_tennis(
347356
"min_alt": None,
348357
"modification_date": workout.modification_date,
349358
"moving": str(workout.moving),
359+
"missing_elevations_processing": (
360+
workout.missing_elevations_processing
361+
),
350362
"next_workout": None,
351363
"notes": None,
352364
"original_file": "gpx",
@@ -424,6 +436,9 @@ def test_it_serializes_workout_with_file_for_running(
424436
"max_power": None,
425437
"max_speed": float(workout.max_speed), # type: ignore [arg-type]
426438
"min_alt": workout.min_alt,
439+
"missing_elevations_processing": (
440+
workout.missing_elevations_processing
441+
),
427442
"modification_date": workout.modification_date,
428443
"moving": str(workout.moving),
429444
"next_workout": None,
@@ -499,6 +514,9 @@ def test_it_serializes_workout_with_file_for_paragliding(
499514
"max_power": None,
500515
"max_speed": float(workout.max_speed), # type: ignore [arg-type]
501516
"min_alt": workout.min_alt,
517+
"missing_elevations_processing": (
518+
workout.missing_elevations_processing
519+
),
502520
"modification_date": workout.modification_date,
503521
"moving": str(workout.moving),
504522
"next_workout": None,
@@ -661,6 +679,9 @@ def test_it_serializes_suspended_workout(
661679
"max_power": None,
662680
"max_speed": workout_cycling_user_1.max_speed,
663681
"min_alt": None,
682+
"missing_elevations_processing": (
683+
workout_cycling_user_1.missing_elevations_processing
684+
),
664685
"modification_date": workout_cycling_user_1.modification_date,
665686
"moving": str(workout_cycling_user_1.moving),
666687
"next_workout": None,

fittrackee/workouts/models.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,12 @@ class Workout(BaseModel):
346346
Geometry(geometry_type="POINT", srid=WGS84_CRS, spatial_index=True),
347347
nullable=True,
348348
)
349-
missing_elevations_processing: Mapped[Optional[str]] = mapped_column(
350-
Enum(MissingElevationsProcessing, name="elevations_processing"),
351-
server_default="NONE",
352-
nullable=False,
349+
missing_elevations_processing: Mapped[MissingElevationsProcessing] = (
350+
mapped_column(
351+
Enum(MissingElevationsProcessing, name="elevations_processing"),
352+
server_default="NONE",
353+
nullable=False,
354+
)
353355
)
354356

355357
user: Mapped["User"] = relationship(
@@ -776,6 +778,9 @@ def serialize(
776778
.order_by(Workout.workout_date.asc())
777779
.first()
778780
)
781+
workout["missing_elevations_processing"] = (
782+
self.missing_elevations_processing
783+
)
779784

780785
else:
781786
next_workout = None

fittrackee_client/src/components/User/ProfileDisplay/UserPreferences.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@
8686
</div>
8787
</dl>
8888
<dl>
89-
<dt>{{ $t('user.PROFILE.MISSING_ELEVATIONS_PROCESSING.LABEL') }}:</dt>
89+
<dt>{{ $t('user.PROFILE.MISSING_ELEVATIONS_PROCESSING_LABEL') }}:</dt>
9090
<dd>
9191
{{
9292
$t(
93-
`user.PROFILE.MISSING_ELEVATIONS_PROCESSING.${
93+
`workouts.MISSING_ELEVATIONS_PROCESSING.${
9494
user.missing_elevations_processing
9595
}`
9696
)

fittrackee_client/src/components/User/ProfileEdition/UserPreferencesEdition.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
</div>
253253
</div>
254254
<label class="form-items">
255-
{{ $t('user.PROFILE.MISSING_ELEVATIONS_PROCESSING.LABEL') }}
255+
{{ $t('user.PROFILE.MISSING_ELEVATIONS_PROCESSING_LABEL') }}
256256
<select
257257
id="missing_elevations_processing"
258258
v-model="userForm.missing_elevations_processing"
@@ -265,7 +265,7 @@
265265
:value="item"
266266
:key="item"
267267
>
268-
{{ $t(`user.PROFILE.MISSING_ELEVATIONS_PROCESSING.${item}`) }}
268+
{{ $t(`workouts.MISSING_ELEVATIONS_PROCESSING.${item}`) }}
269269
</option>
270270
</select>
271271
</label>

fittrackee_client/src/components/Workout/WorkoutDetail/WorkoutChart/index.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@
7575
</div>
7676
<div class="chart-info">
7777
<div class="no-data-cleaning">
78-
{{ $t('workouts.NO_DATA_CLEANING') }}
78+
<span v-if="elevationsSource?.startsWith('open_elevation')">
79+
{{ $t('workouts.MISSING_ELEVATIONS_PROCESSING.LABEL') }}
80+
{{
81+
$t(`workouts.MISSING_ELEVATIONS_PROCESSING.${elevationsSource}`)
82+
}}
83+
</span>
84+
<span v-else-if="authUser.username">
85+
{{ $t('workouts.NO_DATA_CLEANING') }}
86+
</span>
7987
</div>
8088
<div class="elevation-start" v-if="hasElevation">
8189
<label>
@@ -165,6 +173,17 @@
165173
const hasElevation: ComputedRef<boolean> = computed(
166174
() => datasets.value && datasets.value.datasets.elevation?.data.length > 0
167175
)
176+
const elevationsSource: ComputedRef<
177+
null | 'open_elevation' | 'open_elevation_smooth'
178+
> = computed(() =>
179+
workoutData.value.workout.missing_elevations_processing?.startsWith(
180+
'open_elevation'
181+
)
182+
? (workoutData.value.workout.missing_elevations_processing as
183+
| 'open_elevation'
184+
| 'open_elevation_smooth')
185+
: null
186+
)
168187
const chartLoading: ComputedRef<boolean> = computed(
169188
() => workoutData.value.chartDataLoading
170189
)

fittrackee_client/src/components/Workout/WorkoutDetail/index.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@
229229
maxSpeed: segment ? segment.max_speed : workout.max_speed,
230230
minAlt: segment ? segment.min_alt : workout.min_alt,
231231
moving: segment ? segment.moving : workout.moving,
232+
missingElevationsProcessing: segment
233+
? null
234+
: workout.missing_elevations_processing,
232235
nextUrl: urls.nextUrl,
233236
originalFile: segment ? null : workout.original_file,
234237
pauses: segment ? segment.pauses : workout.pauses,

fittrackee_client/src/locales/en/user.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@
127127
},
128128
"MESSAGES_EDITION": "Message preferences edition",
129129
"MESSAGES_PREFERENCES": "Messages preferences",
130-
"MISSING_ELEVATIONS_PROCESSING": {
131-
"LABEL": "Missing elevations processing",
132-
"none": "None",
133-
"open_elevation": "OpenElevation (raw data)",
134-
"open_elevation_smooth": "OpenElevation (smoothed data)"
135-
},
130+
"MISSING_ELEVATIONS_PROCESSING_LABEL": "Missing elevations processing",
136131
"MONDAY": "Monday",
137132
"NOTIFICATIONS": {
138133
"account_creation": "Someone registers",

fittrackee_client/src/locales/en/workouts.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
"MAX_SPEED": "max. speed",
7272
"MAX_SYNC_FILES_IN_ZIP": "max. number of files for synchronous upload",
7373
"MIN_ALTITUDE": "min. altitude",
74+
"MISSING_ELEVATIONS_PROCESSING": {
75+
"LABEL": "Elevations from :",
76+
"none": "None",
77+
"open_elevation": "OpenElevation (raw data)",
78+
"open_elevation_smooth": "OpenElevation (smoothed data)"
79+
},
7480
"MULTISELECT": {
7581
"deselectLabel": "Press enter to remove",
7682
"selectLabel": "Press enter to select",

fittrackee_client/src/locales/fr/user.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@
127127
},
128128
"MESSAGES_EDITION": "Edition des préférences des messages",
129129
"MESSAGES_PREFERENCES": "Preferences des messages",
130-
"MISSING_ELEVATIONS_PROCESSING": {
131-
"LABEL": "Traitement des élévations manquantes",
132-
"none": "Aucun",
133-
"open_elevation": "OpenElevation (données brutes)",
134-
"open_elevation_smooth": "OpenElevation (données lissées)"
135-
},
130+
"MISSING_ELEVATIONS_PROCESSING_LABEL": "Traitement des altitudes manquantes",
136131
"MONDAY": "Lundi",
137132
"NOTIFICATIONS": {
138133
"account_creation": "Quelqu'un s'est enregistré",

fittrackee_client/src/locales/fr/workouts.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
"MAX_SPEED": "vitesse max.",
7272
"MAX_SYNC_FILES_IN_ZIP": "nombre max. de fichiers pour un chargement synchrone ",
7373
"MIN_ALTITUDE": "altitude min.",
74+
"MISSING_ELEVATIONS_PROCESSING": {
75+
"LABEL": "Altitudes provenant de :",
76+
"none": "Aucun",
77+
"open_elevation": "OpenElevation (données brutes)",
78+
"open_elevation_smooth": "OpenElevation (données lissées)"
79+
},
7480
"MULTISELECT": {
7581
"deselectLabel": "Appuyer sur Entrée pour supprimer",
7682
"selectLabel": "Appuyer sur Entrée pour sélectionner",

0 commit comments

Comments
 (0)