find uncompleted builds only among last builds

This commit is contained in:
oleg 2015-10-14 21:59:36 +03:00
parent 9b7bb39d91
commit 812432b51c

9
app.js
View File

@ -67,13 +67,14 @@ var completeUncompletedBuilds = function(callback) {
function() {
db.builds.find({
start: {descCreateDate: ''},
filter: function(build) {
return !build.completed;
},
limit: 100
}, this.slot());
},
function(err, uncompletedBuilds) {
function(err, lastBuilds) {
var uncompletedBuilds = _(lastBuilds).filter(function(lastBuild) {
return !lastBuild.completed;
});
var completeGroup = this.makeGroup();
if (uncompletedBuilds.length) {