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: { methods: {
info(route) { 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) { height(route) {
return route.height.heightDiffDifficulties ? route.height.heightDiffDifficulties + ' m, ' : ''; return route.height.heightDiffDifficulties ? route.height.heightDiffDifficulties + ' m' : '';
}, },
orientations(route) { orientations(route) {
if (route.orientations) { return route.orientations ? route.orientations.join(',') : '';
return route.orientations.join(',')
}
}, },
rating(route) { rating(route) {
if (route.rating) { let items = []
let str = route.rating.global + ' ' + route.rating.free
if (route.rating.required) for (let value of Object.values(route.rating)) {
str += '>' + route.rating.required if (value) items.push(value)
if (route.rating.engagement)
str += ' ' + route.rating.engagement
if (route.rating.equipmentQuality)
str += ' ' + route.rating.equipmentQuality
return str
} }
return items.join(' ')
} }
} }
} }