diff --git a/src/components/Routes.vue b/src/components/Routes.vue index 13f018f..ab904cf 100644 --- a/src/components/Routes.vue +++ b/src/components/Routes.vue @@ -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(' ') } } }