Created
April 22, 2012 22:44
-
-
Save raytiley/2467367 to your computer and use it in GitHub Desktop.
Design Phase 4 - Report Resolver Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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