Fix recents for services object

This commit is contained in:
Jonathan Cremin 2015-01-06 23:42:27 +00:00
parent 9d60b26cfa
commit 89d0779751

7
app.js
View file

@ -84,12 +84,7 @@ app.get('/recent', function(req, res, next) {
req.db.matches.find().sort({created_at:-1}).limit(6).toArray().then(function(docs){
var recents = [];
docs.forEach(function(doc) {
doc.services.some(function(item) {
if (item.service == doc._id.split("$$")[0]) {
recents.push(item);
return false;
}
});
recents.push(doc.services[doc._id.split("$$")[0]])
});
res.json({recents:recents});
}).catch(function (error) {