resumen
This commit is contained in:
@@ -62,7 +62,8 @@ router.get("/resumen_compras", checkAuth, async (req, res) => {
|
|||||||
compras_ = await Compras.aggregate([
|
compras_ = await Compras.aggregate([
|
||||||
{$match: { $and: [{ user:req.userData._id}, filtros] }},
|
{$match: { $and: [{ user:req.userData._id}, filtros] }},
|
||||||
{$group:{_id:{categoria:"$categoria"},total:{$sum:"$valor"}}}
|
{$group:{_id:{categoria:"$categoria"},total:{$sum:"$valor"}}}
|
||||||
]);
|
]).sort({total:"desc"});
|
||||||
|
|
||||||
compras_.forEach(element => {
|
compras_.forEach(element => {
|
||||||
//console.log(element.total)
|
//console.log(element.total)
|
||||||
labels.push(element._id.categoria)
|
labels.push(element._id.categoria)
|
||||||
@@ -74,4 +75,4 @@ router.get("/resumen_compras", checkAuth, async (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user