瀏覽代碼

Another bug fix.

Lee Morgan 5 年之前
父節點
當前提交
52571c38d4
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      controllers/merchantData.js

+ 2 - 3
controllers/merchantData.js

@@ -369,7 +369,7 @@ module.exports = {
     */
     deleteMerchant: function(req, res){
         if(res.locals.owner.merchants.length === 1) throw "one";
-        console.log(res.locals.owner.merchants.id(res.locals.merchant._id));
+        
         for(let i = 0; i < res.locals.owner.merchants.length; i++){
             if(res.locals.owner.merchants[i].toString() === res.locals.merchant._id.toString()){
                 res.locals.owner.merchants.splice(i, 1);
@@ -384,7 +384,7 @@ module.exports = {
 
         let transactions = Transaction.aggregate([
             {$match: {
-                merchant: ObjectId(res.locals.merchant._id),
+                merchant: ObjectId(res.locals.owner.merchants[0]._id),
                 date: {$gte: then}
             }},
             {$sort: {date: -1}},
@@ -402,7 +402,6 @@ module.exports = {
             transactions
         ])
             .then((response)=>{
-                console.log(response[4]);
                 let responseOwner = {
                     _id: res.locals.owner._id,
                     email: res.locals.owner.email,