From 6567143ff53d43ffc8d76341e2e92f66e3c7bfc2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 4 May 2022 15:14:17 +0200 Subject: [PATCH 1/2] update job if users assigns him/herself as referrer and job is not null --- .../public/vuejs/AccompanyingCourse/store/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 57415565b..c5150b015 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -253,7 +253,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou state.accompanyingCourse.administrativeLocation = value; }, updateReferrer(state, value) { - //console.log('value', value); state.accompanyingCourse.user = value; }, updateJob(state, value) { @@ -775,9 +774,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou throw error; }) }, - updateReferrer({ commit }, payload) { - console.log('update referrer', payload); - console.log('payload !== null', payload !== null); + updateReferrer({ commit, state }, payload) { const url = `/api/1.0/person/accompanying-course/${id}.json`; let body = { type: "accompanying_period", user: null }; @@ -788,7 +785,10 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou return makeFetch('PATCH', url, body) .then((response) => { commit('updateReferrer', response.user); - commit('setFilteredReferrersSuggested'); + if (null !== payload.user_job && payload.user_job !== state.accompanyingCourse.job) { + this.dispatch('updateJob', payload.user_job); + } + // commit('setFilteredReferrersSuggested'); // this mutation doesn't exist? }) .catch((error) => { commit('catchError', error); @@ -799,6 +799,8 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou const url = `/api/1.0/person/accompanying-course/${id}.json`; let body = { type: "accompanying_period", job: null }; + console.log('update job', payload); + if (payload !== null) { body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } }; } From 10d00787164688ffe073feebcdc7229bdf543309 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 4 May 2022 15:16:13 +0200 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90f4c2503..e9b78cdf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to * [person] add maritalStatusComment to PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/582) * Load relationships without gender in french fixtures * Add command to remove old draft accompanying periods +* [parcours]: If users assings him/herself as referrer and job is not null. Update parcours job (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/578)