Skip to content

Instantly share code, notes, and snippets.

@raytiley
Created April 22, 2012 22:44
Show Gist options
  • Save raytiley/2467367 to your computer and use it in GitHub Desktop.
Save raytiley/2467367 to your computer and use it in GitHub Desktop.
Design Phase 4 - Report Resolver Module
//Include required modules and setup some variables
var reportsRepo = require('ReportsRepository'),
routingServ = require('RoutingService'),
TIMEOUT = 1000 * 60 * 5; // 5 minutes
setTimeout(function(){
//Lookup all unresolved reports that should be resolved due to current time
reportsRepo.getUnresolvedTimeReports(function(err, data){
//Itterate through each report
for(report in data) {
report.resolved = true; //resolve report
reportsRepo.updateReport(report, function(err, data){
//Update cost table by oposite of cost delta
routingServ.updateCost(report.lat, report.lon, report.costTable, -report.category.costDelta);
});
}
});
}, TIMEOUT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment