aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-02-07 16:29:00 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-02-07 16:29:00 +0100
commita07e3de412d80a9aa56c580f2afe62025b0878f3 (patch)
treee0f667b289d6dd209b4fc15cc48319fc8b6d9541 /src
parent5a11784a039c917c2c6e70d59d97ad439e5f0c35 (diff)
Make getUsers easier to understand
Diffstat (limited to 'src')
-rw-r--r--src/server/lib/getMeetingpointData.js46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/server/lib/getMeetingpointData.js b/src/server/lib/getMeetingpointData.js
index 34ed89f..b2225f4 100644
--- a/src/server/lib/getMeetingpointData.js
+++ b/src/server/lib/getMeetingpointData.js
@@ -14,27 +14,31 @@ function getUsers(page) {
const regexs = [/var classes = \[(.+)\];/, /var teachers = \[(.+)\];/, /var rooms = \[(.+)\];/, /var students = \[(.+)\];/];
const items = regexs.map(regex => script.match(regex)[1].split(',').map(item => item.replace(/"/g, '')));
- return []
- .concat(items[0].map((item, index) => ({
- type: 'c',
- value: item,
- index,
- })))
- .concat(items[1].map((item, index) => ({
- type: 't',
- value: item,
- index,
- })))
- .concat(items[2].map((item, index) => ({
- type: 'r',
- value: item,
- index,
- })))
- .concat(items[3].map((item, index) => ({
- type: 's',
- value: item,
- index,
- })));
+ const classes = items[0].map((item, index) => ({
+ type: 'c',
+ value: item,
+ index,
+ }));
+
+ const teachers = items[1].map((item, index) => ({
+ type: 't',
+ value: item,
+ index,
+ }));
+
+ const rooms = items[2].map((item, index) => ({
+ type: 'r',
+ value: item,
+ index,
+ }));
+
+ const students = items[3].map((item, index) => ({
+ type: 's',
+ value: item,
+ index,
+ }));
+
+ return _.flatten([classes, teachers, rooms, students]);
}
function getValidWeekNumbers(page) {