From 6a4d7fbece5e06f6f00b2e4e6d3d8d7798fe23c3 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 20 Dec 2021 12:52:29 +0100 Subject: [PATCH] AccompanyingCourseWorkEdit: fix bug, remove goal one by one (adding a temporary negative index on just created goals) --- CHANGELOG.md | 2 +- .../public/vuejs/AccompanyingCourseWorkEdit/App.vue | 10 ++++------ .../public/vuejs/AccompanyingCourseWorkEdit/store.js | 7 +++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65824436a..4476a8670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to * [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for stable releases; * date versioning for test releases -* [accompanyingCourse_work] fix styles conflicts +* [accompanyingCourse_work] fix styles conflicts + fix bug with remove goal (remove goals one at a time) ## Unreleased diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index 10a99534b..32e2a5e14 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -50,10 +50,10 @@ -
-
- {{ g.goal.title.fr }} -
+
+
+ {{ g.goal.title.fr }} +
@@ -428,11 +428,9 @@ export default { this.isExpanded = !this.isExpanded; }, addGoal(g) { - this.$store.commit('addGoal', g); }, removeGoal(g) { - this.$store.commit('removeGoal', g); }, addEvaluation(e) { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index fbc5d2805..a4beb223e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -164,7 +164,14 @@ const store = createStore({ note: '', results: [] } + const tmpIndex = () => { + let ar = state.goalsPicked.map(g => g.id), + s = Math.min(...ar); + return (s < 0) ? s : 0 + }; + g.id = tmpIndex() -1 state.goalsPicked.push(g); + //console.log('goals picked ids', state.goalsPicked.map(g => g.id)) }, removeGoal(state, goal) { state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);