Merge branch 'refactor' of https://github.com/gmetais/YellowLabTools into refactor

This commit is contained in:
Gaël Métais
2014-12-19 14:51:39 +01:00
3 changed files with 27 additions and 8 deletions
+15 -6
View File
@@ -52,16 +52,25 @@ var ApiController = function(app) {
.then(function(data) {
debug('Success');
runsDatastore.markAsComplete(run.runId);
// Save result in datastore
data.runId = run.runId;
resultsDatastore.saveResult(data);
resultsDatastore.saveResult(data)
.then(function() {
// Send result if the user was waiting
if (run.params.waitForResponse) {
res.redirect(302, '/api/results/' + run.runId);
}
runsDatastore.markAsComplete(run.runId);
// Send result if the user was waiting
if (run.params.waitForResponse) {
res.redirect(302, '/api/results/' + run.runId);
}
})
.fail(function(err) {
debug('Saving results to resultsDatastore failed:');
debug(err);
});
}).fail(function(err) {