vue activity: fix duplicates and add condition in initial loading

This commit is contained in:
2021-06-29 11:49:23 +02:00
parent b705c5910f
commit beca41774e
3 changed files with 42 additions and 37 deletions

View File

@@ -120,24 +120,30 @@ export default {
getSocialIssues().then(response => new Promise((resolve, reject) => {
this.$store.commit('updateIssuesOther', response.results);
// ajoute dans la liste les issues déjà associées (si elles ne s'y trouvent pas déjà)
this.socialIssuesSelected.forEach(issue => {
this.$store.commit('addIssueInList', issue);
if (this.socialIssuesList.filter(i => i.id === issue.id).length !== 1) {
this.$store.commit('addIssueInList', issue);
}
}, this);
console.log(this.socialIssuesOther.length, this.socialIssuesOther);
// enlève du multiselect les issues qui sont dans la liste des checkbox
this.socialIssuesList.forEach(issue => {
this.$store.commit('removeIssueInOther', issue);
}, this);
console.log(this.socialIssuesOther.length); // grr !!!
// TODO décompter les issues initiales du multiselect
// filtre les issues
this.$store.commit('filterList', 'issues');
// ajoute dans la liste les actions déjà associées (si elles ne s'y trouvent pas déjà)
this.socialActionsSelected.forEach(action => {
this.$store.commit('addActionInList', action);
}, this);
// filtre les actions
this.$store.commit('filterList', 'actions');
this.issueIsLoading = false;
resolve();
}));
@@ -175,22 +181,25 @@ export default {
this.$store.commit('resetActionsList');
// remettre les ActionsSelected dans ActionsList
this.socialIssuesSelected.forEach(item => {
console.log('for issue', item.id);
//console.log('for issue', item.id);
this.actionIsLoading = true;
getSocialActionByIssue(item.id)
.then(actions => new Promise((resolve, reject) => {
actions.results.forEach(action => {
this.$store.commit('addActionInList', action);
}, this);
this.$store.commit('filterList', 'actions');
this.actionIsLoading = false;
resolve();
.then(actions => new Promise((resolve, reject) => {
actions.results.forEach(action => {
this.$store.commit('addActionInList', action);
}, this);
this.$store.commit('filterList', 'actions');
this.actionIsLoading = false;
resolve();
}));
}, this);
}
}