From ff2b3eb8f479065431d0a56b21fa931dac26880c Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 20 Mar 2018 16:10:34 +0100 Subject: Add common filters to the users object --- src/client/react/users.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/client') diff --git a/src/client/react/users.js b/src/client/react/users.js index 492bf60..3a10a51 100644 --- a/src/client/react/users.js +++ b/src/client/react/users.js @@ -33,7 +33,16 @@ users.allUsers = USERS.map(user => ({ id: getId(user), })); +users.allRooms = users.allUsers.filter(user => user.type === 'r'); +users.allStudents = users.allUsers.filter(user => user.type === 's'); +users.allTeachers = users.allUsers.filter(user => user.type === 't'); +users.allClasses = users.allUsers.filter(user => user.type === 'c'); + users.allIds = users.allUsers.map(user => user.id); +users.allRoomIds = users.allRooms.map(user => user.id); +users.allStudentIds = users.allStudents.map(user => user.id); +users.allTeacherIds = users.allTeachers.map(user => user.id); +users.allClassIds = users.allClasses.map(user => user.id); users.byId = keyBy(users.allUsers, 'id'); -- cgit v1.1