aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-03-20 16:10:34 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-03-20 16:10:34 +0100
commitff2b3eb8f479065431d0a56b21fa931dac26880c (patch)
treeea9e1848772bea9b4c71a50893d3b7a9ee7d938d /src/client
parent3cb7c15d15f33e9b0ce06dbf0072021f6921dbe7 (diff)
Add common filters to the users object
Diffstat (limited to 'src/client')
-rw-r--r--src/client/react/users.js9
1 files changed, 9 insertions, 0 deletions
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');