Skip to content

Commit

Permalink
Complete notification trigger according to user notification profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
malithjkmt committed Jun 15, 2016
1 parent b7dc259 commit f9e0adc
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 64 deletions.
113 changes: 57 additions & 56 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions imports/ui/pages/SetupNotifications/setupNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,8 @@ Template.setupNotifications.events({

},
'click #save'(event) {
//save the notification (notiCircles) to route with user_id
/*
notifications{
{noti:, user_id},

}
*/
console.log(notiPoints);

Meteor.call('saveNoti', JSON.stringify(notiPoints), routeID, userID);
notiPoints = null;
}
Expand Down
8 changes: 7 additions & 1 deletion imports/ui/pages/testingConsole/dummyTruck.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Template.dummyMap.onCreated(function () {
Meteor.subscribe('trucks');
Meteor.subscribe('notifications')
Meteor.subscribe('routes');
Meteor.subscribe('allUsers')

self = this;
GoogleMaps.ready('dummyMap', function (dummyMap) {
Expand Down Expand Up @@ -210,7 +211,12 @@ Template.dummyMapView.events({

var range = distance(noti.lat, noti.lng, truck.lat, truck.lng);
if (range < 50) {
console.log('inside noti cirlce!! user_id is ' + notification.user_id+ " distance is "+ range);
var notiUserLoc = Meteor.users.findOne({_id:notification.user_id}).profile.location;
console.log(notiUserLoc);

var distanceToTruck = distance(notiUserLoc.lat, notiUserLoc.lng, truck.lat, truck.lng) // get distance to user from the truck

console.log('inside noti cirlce!! user_id is ' + notification.user_id+ " range is "+ range +" distance is "+distanceToTruck);

}
})
Expand Down
4 changes: 4 additions & 0 deletions lib/publications.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ if (Meteor.isServer) {
'notifications', function notificationsPublication() {
return Notifications.find({});
});
Meteor.publish(
'allUsers', function usersPublication() {
return Meteor.users.find({});
});
}

0 comments on commit f9e0adc

Please sign in to comment.