NUDelta/ce-platform

Time and Weather based Affordances should update more frequently

youralien opened this issue · 1 comments

The whole system currently runs on an event-based model, upon a user's location change.

However, there are cases where situations are changing despite a static location. For example, the weather can change to rainy, despite a user being in the same location. Or time continues to progress, despite a user being in the same location.

image
This illustrates a new model, where the event-based onLocationUpdate model is compatible with a more frequent polling-based onTimeElasped model.

To implement this, I would do the following tasks

  • Make the processes for "coordinating users to needs" in a separate function. Currently it occurs in the callback of getAffordancesFromLocation:
    getAffordancesFromLocation(uid, location, retrievePlaces, function (uid, bgLocationObject, affordances) {
    ,
  • Create a polling function on the server side onTimeElasped, perhaps on a 5 minute interval. Use functions like setInterval. Perhaps, it could iterate through all users in db.Locations
  • Then make sure "coordinating users to needs" is called for the onLocationUpdate and the onTimeElapsed models (see
    decomissionFromAssignmentsIfAppropriate(uid, sharedAffs);
    )