Client - fix display when workout has no evelation data

This commit is contained in:
Sam 2023-07-18 19:18:10 +02:00
parent c409f2cbab
commit 62f3940e7d

View File

@ -61,7 +61,7 @@
</div>
<div
class="workout-data"
:class="{ 'without-gpx': workout && !workout.with_gpx }"
:class="{ 'without-elevation': !hasElevation(workout) }"
@click="
workout.id
? $router.push({
@ -92,7 +92,7 @@
:useImperialUnits="useImperialUnits"
/>
</div>
<div class="data elevation" v-if="workout && workout.with_gpx">
<div class="data elevation" v-if="hasElevation(workout)">
<img
class="mountains"
src="/img/workouts/mountains.svg"
@ -114,7 +114,7 @@
/>
</div>
</div>
<div class="data altitude" v-if="hasElevation(workout)">
<div class="data altitude" v-if="hasUphillValue(workout)">
<i class="fa fa-location-arrow" aria-hidden="true" />
<div class="data-values">
+<Distance
@ -169,7 +169,16 @@
)
function hasElevation(workout: IWorkout): boolean {
return workout && workout.ascent !== null && workout.descent !== null
return (
workout.with_gpx && workout.min_alt !== null && workout.max_alt !== null
)
}
function hasUphillValue(workout: IWorkout): boolean {
return (
hasElevation(workout) &&
workout.ascent !== null &&
workout.descent !== null
)
}
</script>
@ -273,7 +282,7 @@
}
}
&.without-gpx {
&.without-elevation {
.img,
.data {
justify-content: center;