Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/gymRoutes/GymRouteTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ export default {
formatRoutes () {
for (const route of this.routes) {
const styles = []
for (const section of route.sections) {
for (const style of section.styles) {
for (const section of route.sections ?? []) {
for (const style of section.styles ?? []) {
styles.push(style)
}
}
Expand Down
10 changes: 9 additions & 1 deletion components/gymRoutes/forms/GymRouteForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ export default {
gym_space_id: this.gymSector.gym_space.id,
gym_sector_id: null,
gym_id: this.gymSector.gym.id,
sections: this.gymRoute?.sections || [{ grade: null, height: null, styles: [] }]
sections: this.gymRoute?.sections ?? [{ grade: null, height: null, styles: [] }]
},
climbingGymList: [
{ text: this.$t('models.climbs.sport_climbing'), value: 'sport_climbing' },
Expand Down Expand Up @@ -608,6 +608,14 @@ export default {
}
},

watch: {
multiPitch (newVal) {
if (!newVal && this.data.sections.length > 1) {
this.data.sections.splice(1)
}
}
},

mounted () {
this.getGymLevels()
this.multiPitch = this.data.sections.length > 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default {
methods: {
icons () {
const styles = []
for (const section of this.gymRoute.sections) {
for (const style of section.styles) {
for (const section of this.gymRoute.sections ?? []) {
for (const style of section.styles ?? []) {
styles.push(style)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="d-inline-bloc">
<template v-for="section in gymRoute.sections">
<v-icon
v-for="(style, styleIndex) in section.styles"
v-for="(style, styleIndex) in section.styles ?? []"
:key="`style-${styleIndex}`"
class="mr-1"
:color="styleColor(style)"
Expand Down
2 changes: 1 addition & 1 deletion components/gymRoutes/partial/GymRouteClimbingStyles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
L.{{ sectionIndex + 1 }} :
</span>
<v-chip
v-for="(style, styleIndex) in section.styles"
v-for="(style, styleIndex) in section.styles ?? []"
:key="`style-${styleIndex}`"
small
class="mr-2"
Expand Down
2 changes: 1 addition & 1 deletion models/GymRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class GymRoute extends ActiveData {

get hasStyles () {
let styleCounter = 0
for (const section of this.sections) {
for (const section of this.sections ?? []) {
styleCounter += section?.styles?.length || 0
}
return styleCounter > 0
Expand Down
Loading