Fix recents for services object
This commit is contained in:
parent
9d60b26cfa
commit
89d0779751
1 changed files with 1 additions and 6 deletions
7
app.js
7
app.js
|
@ -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){
|
req.db.matches.find().sort({created_at:-1}).limit(6).toArray().then(function(docs){
|
||||||
var recents = [];
|
var recents = [];
|
||||||
docs.forEach(function(doc) {
|
docs.forEach(function(doc) {
|
||||||
doc.services.some(function(item) {
|
recents.push(doc.services[doc._id.split("$$")[0]])
|
||||||
if (item.service == doc._id.split("$$")[0]) {
|
|
||||||
recents.push(item);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
res.json({recents:recents});
|
res.json({recents:recents});
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue