@dhyasama/totem-models 5.1.0 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.npmignore ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
@@ -572,14 +572,20 @@ module.exports = function(mongoose, config) {
572
572
 
573
573
  Organization.methods.addDeal = function(deal) {
574
574
 
575
+ console.log('Organization.methods.addDeal');
576
+ console.log(deal);
577
+
575
578
  var self = this;
576
579
 
580
+ console.log(self.deals);
581
+
577
582
  // Validate inputs
578
583
  if (!deal) throw new Error('deal is required');
579
584
 
580
585
  // Check if this deal already exists
581
586
  var dealMatch = _.find(self.deals, function(d) {
582
- return d._id.toString() === deal._id.toString();
587
+ var did = d._id ? d._id.toString() : d;
588
+ return did === deal._id.toString();
583
589
  });
584
590
 
585
591
  // Update the deal