-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschedulerLogic.js
45 lines (35 loc) · 1007 Bytes
/
schedulerLogic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function makeSchedule() {
var database = firebase.database();
var usersRef = database.ref('Users');
var eventsRef = database.ref('Events');
var scheduleRef = database.ref('Schedule');
var users = [];
var i = 0;
usersRef.once("value", function(snapshot){
snapshot.forEach(function(childSnapshot){
users[i] = childSnapshot.val();
i++;
})
})
var events = [];
var j = 0;
eventsRef.once("value", function(snapshot){
snapshot.forEach(function(childSnapshot){
events[i] = childSnapshot.val();
i++;
})
})
scheduleRef.push({
//push days and events
});
}
function getUserData(userEmail, db){
var database = db;
var usersRef = database.ref('Users');
usersRef.once("value", function(snapshot){
snapshot.forEach(function(childSnapshot){
var childData = childSnapshot.val();
});
});
return childData;
}