mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
cleaning
This commit is contained in:
parent
55c2aed613
commit
5e2b70249e
@ -64,12 +64,8 @@ const store = createStore({
|
||||
//console.log('getParticipationsByCourse', course_id)
|
||||
const course = state.courses.filter(c => c.id === course_id)[0]
|
||||
const currentParticipations = course.participations.filter(p => p.endDate === null)
|
||||
console.log('get persons in', course_id,
|
||||
currentParticipations.map(p => p.person.id), //currentParticipations.map(p => p.person),
|
||||
'with folded', currentParticipations
|
||||
.filter(p => p.person.folded === true)
|
||||
.map(p => p.person.id)
|
||||
)
|
||||
console.log('get persons in', course_id, currentParticipations.map(p => p.person.id),
|
||||
'with folded', currentParticipations.filter(p => p.person.folded === true).map(p => p.person.id))
|
||||
return currentParticipations
|
||||
},
|
||||
|
||||
@ -77,31 +73,26 @@ const store = createStore({
|
||||
//console.log('getMembersByHousehold', household_id)
|
||||
const household = state.households.filter(h => h.id === household_id)[0]
|
||||
const currentMembers = household.members.filter(m => household.current_members_id.includes(m.id))
|
||||
console.log('get persons in', household_id,
|
||||
currentMembers.map(m => m.person.id), //currentMembers.map(m => m.person),
|
||||
'with folded', currentMembers
|
||||
.filter(m => m.person.folded === true)
|
||||
.map(m => m.person.id)
|
||||
)
|
||||
console.log('get persons in', household_id, currentMembers.map(m => m.person.id),
|
||||
'with folded', currentMembers.filter(m => m.person.folded === true).map(m => m.person.id))
|
||||
return currentMembers
|
||||
},
|
||||
|
||||
/**
|
||||
* This getter compare input array (participations|members) to personLoadedIds array
|
||||
* It return an array of folded persons
|
||||
*/
|
||||
getFoldedPersons: (state) => (array) => {
|
||||
//console.log('array', array.map(r => r.person.id))
|
||||
|
||||
let folded = []
|
||||
array.forEach(a => {
|
||||
let id = (typeof a.person._id !== 'undefined') ? a.person._id : a.person.id
|
||||
array.forEach(item => {
|
||||
let id = (typeof item.person._id !== 'undefined') ? item.person._id : item.person.id
|
||||
if (state.personLoadedIds.includes(id)) {
|
||||
folded.push(state.persons.filter(person => person._id === id)[0])
|
||||
}
|
||||
})
|
||||
console.log('get FoldedPersons', folded.map(r => r.id))
|
||||
//console.log('array', array.map(r => r.person.id))
|
||||
console.log('get FoldedPersons', folded.map(f => f.id))
|
||||
return folded
|
||||
|
||||
//return array
|
||||
// .filter(i => i.person.folded === true) ///// <== tout ce qui passe dans la mutation addPerson reçoit un _id
|
||||
// .map(i => i.person) ///// donc changer le filtrage
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user