Ver código fonte

Fix bug with restarting server whilst an event remains scheduled

Matt Coles 9 anos atrás
pai
commit
7b1bea74a9

+ 1 - 1
presenters/event-controller.js

137
   get_event: function (event_id, auth, complete, preauth) {
137
   get_event: function (event_id, auth, complete, preauth) {
138
     redis.hgetall("event:" + event_id, function (err, event) {
138
     redis.hgetall("event:" + event_id, function (err, event) {
139
       if (preauth) {
139
       if (preauth) {
140
-        if (event) {
140
+        if (event.name) {
141
           event.attendees = JSON.parse(event.attendees);
141
           event.attendees = JSON.parse(event.attendees);
142
           complete({
142
           complete({
143
             "event": event,
143
             "event": event,

+ 0 - 1
presenters/notification-controller.js

5
     event_controller.get_event(event_id, "", function (response) {
5
     event_controller.get_event(event_id, "", function (response) {
6
       var attendees = response.event.attendees;
6
       var attendees = response.event.attendees;
7
       console.log("Triggered Event: " + response.event.name);
7
       console.log("Triggered Event: " + response.event.name);
8
-      console.dir(attendees);
9
       attendees.map(function (attendee) {
8
       attendees.map(function (attendee) {
10
         console.log((new Date(Date.now())).toString() + " : Sending push notification to " + attendee + " for event starting at " + (new Date(Number(response.event.start)).toString()));
9
         console.log((new Date(Date.now())).toString() + " : Sending push notification to " + attendee + " for event starting at " + (new Date(Number(response.event.start)).toString()));
11
       });
10
       });

+ 1 - 1
presenters/schedule-controller.js

23
     var event_ids = [];
23
     var event_ids = [];
24
     stream.on('data', function (keys) {
24
     stream.on('data', function (keys) {
25
       keys.map(function (key) {
25
       keys.map(function (key) {
26
-        event_ids.push(key);
26
+        event_ids.push(key.split(":")[1]);
27
       });
27
       });
28
     })
28
     })
29
     stream.on('end', function () {
29
     stream.on('end', function () {