From be53003e011ff025fcadc053ac05c8ce2e2d47c4 Mon Sep 17 00:00:00 2001 From: Guillaume Gautreau Date: Tue, 3 Mar 2026 00:09:06 +0100 Subject: [PATCH 1/2] fix: don't keep multiple sections when multiPitch is deselected --- components/gymRoutes/forms/GymRouteForm.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/gymRoutes/forms/GymRouteForm.vue b/components/gymRoutes/forms/GymRouteForm.vue index 25a029ac..c760f097 100644 --- a/components/gymRoutes/forms/GymRouteForm.vue +++ b/components/gymRoutes/forms/GymRouteForm.vue @@ -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 From c70e629fb5a4fbc868bebcf72b9ca719fb980c64 Mon Sep 17 00:00:00 2001 From: Guillaume Gautreau Date: Tue, 3 Mar 2026 17:39:31 +0100 Subject: [PATCH 2/2] fix: correctly handle null styles --- components/gymRoutes/GymRouteTable.vue | 4 ++-- components/gymRoutes/forms/GymRouteForm.vue | 2 +- .../gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue | 4 ++-- components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue | 2 +- components/gymRoutes/partial/GymRouteClimbingStyles.vue | 2 +- models/GymRoute.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/gymRoutes/GymRouteTable.vue b/components/gymRoutes/GymRouteTable.vue index fa689c96..408aff80 100644 --- a/components/gymRoutes/GymRouteTable.vue +++ b/components/gymRoutes/GymRouteTable.vue @@ -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) } } diff --git a/components/gymRoutes/forms/GymRouteForm.vue b/components/gymRoutes/forms/GymRouteForm.vue index c760f097..aff6ab8d 100644 --- a/components/gymRoutes/forms/GymRouteForm.vue +++ b/components/gymRoutes/forms/GymRouteForm.vue @@ -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' }, diff --git a/components/gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue b/components/gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue index a4bf2c5c..2f4d049a 100644 --- a/components/gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue +++ b/components/gymRoutes/partial/GymRouteClimbingSimpleStyleIcons.vue @@ -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) } } diff --git a/components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue b/components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue index a56e784f..d3635783 100644 --- a/components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue +++ b/components/gymRoutes/partial/GymRouteClimbingStyleIcons.vue @@ -2,7 +2,7 @@