Fix display of routes info

This commit is contained in:
Hubert Van De Walle 2020-09-24 12:36:01 +02:00
parent 5f905c578d
commit 03bd94636d

View File

@ -15,27 +15,24 @@ export default {
},
methods: {
info(route) {
return this.height(route) + this.orientations(route) + this.rating(route)
return [this.height(route), this.orientations(route), this.rating(route)]
.filter(e => !!e)
.join(', ')
},
height(route) {
return route.height.heightDiffDifficulties ? route.height.heightDiffDifficulties + ' m, ' : '';
return route.height.heightDiffDifficulties ? route.height.heightDiffDifficulties + ' m' : '';
},
orientations(route) {
if (route.orientations) {
return route.orientations.join(',')
}
return route.orientations ? route.orientations.join(',') : '';
},
rating(route) {
if (route.rating) {
let str = route.rating.global + ' ' + route.rating.free
if (route.rating.required)
str += '>' + route.rating.required
if (route.rating.engagement)
str += ' ' + route.rating.engagement
if (route.rating.equipmentQuality)
str += ' ' + route.rating.equipmentQuality
return str
let items = []
for (let value of Object.values(route.rating)) {
if (value) items.push(value)
}
return items.join(' ')
}
}
}