API & Client - refacto + handle null values

This commit is contained in:
Sam
2023-07-29 10:51:04 +02:00
parent 4af294cd4a
commit 01ee50c50c
4 changed files with 23 additions and 20 deletions

View File

@ -12,7 +12,7 @@
<span class="value">{{ workoutObject.duration }})</span>
</div>
</div>
<div class="workout-data">
<div class="workout-data" v-if="workoutObject.distance !== null">
<i class="fa fa-road" aria-hidden="true" />
<span class="label"> {{ $t('workouts.DISTANCE') }} </span>:
<Distance

View File

@ -98,6 +98,7 @@
{{ $t('workouts.DISTANCE') }}
</span>
<Distance
v-if="workout.distance !== null"
:distance="workout.distance"
unitFrom="km"
:useImperialUnits="user.imperial_units"
@ -114,6 +115,7 @@
{{ $t('workouts.AVE_SPEED') }}
</span>
<Distance
v-if="workout.ave_speed !== null"
:distance="workout.ave_speed"
unitFrom="km"
:speed="true"
@ -125,6 +127,7 @@
{{ $t('workouts.MAX_SPEED') }}
</span>
<Distance
v-if="workout.max_speed !== null"
:distance="workout.max_speed"
unitFrom="km"
:speed="true"

View File

@ -55,19 +55,19 @@ export interface IWeather {
export interface IWorkout {
ascent: number | null
ave_speed: number
ave_speed: number | null
bounds: number[]
creation_date: string
descent: number | null
distance: number
duration: string
distance: number | null
duration: string | null
id: string
map: string | null
max_alt: number | null
max_speed: number
max_speed: number | null
min_alt: number | null
modification_date: string | null
moving: string
moving: string | null
next_workout: string | null
notes: string
pauses: string | null
@ -87,12 +87,12 @@ export interface IWorkoutObject {
ascent: number | null
aveSpeed: number | null
descent: number | null
distance: number
duration: string
distance: number | null
duration: string | null
maxAlt: number | null
maxSpeed: number | null
minAlt: number | null
moving: string
moving: string | null
nextUrl: string | null
pauses: string | null
previousUrl: string | null