Skip to content

Commit

Permalink
Fix Wrong code
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Reyes Ureña committed May 30, 2013
1 parent 3db8983 commit 3e77609
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions lib/groupService.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,22 @@ function addQueuesFromGroup(req, res, next) {
var db = dbCluster.getTransactionDb(req.params.groupName);

if (req.body && req.body.groups) {
async.map(req.body.groups, getElementsHandler(db), function (error, results) {
if (req.body.queue) {
var processedResults = [];
for (var i = 0; i < results[0].length; i++) {
processedResults.push({
id: results[0][i]
});
async.map(req.body.groups, getElementsHandler(db),
function(error, results) {
//[[q,q,q],[q],[q,q]]
var processedResults = [];
for (var j = 0; j < results.length; j++) {
for (var i = 0; i < results[j].length; i++) {
processedResults.push({
id: results[j][i]
});
}
}
if (req.body.queue) {
req.body.queue = req.body.queue.concat(processedResults);
} else {
req.body.queue = processedResults;
}
req.body.queue = req.body.queue.concat(processedResults);
} else {
req.body.queue = results[0];
}

next();
});
Expand Down

0 comments on commit 3e77609

Please sign in to comment.