@dhyasama/totem-models 4.5.2 → 4.5.3

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.
@@ -594,27 +594,22 @@ module.exports = function(mongoose, config) {
594
594
 
595
595
  // Check if this deal already exists
596
596
  var dealMatch = _.find(self.deals, function(d) {
597
- var cid = d.customer._id ? d.customer._id.toString() : d.customer.toString();
598
- return cid == customer._id.toString();
597
+ return utils.getIdAsString(d, 'customer') == customer._id.toString();
599
598
  });
600
599
 
601
600
  // Update the deal
602
601
  if (dealMatch) {
603
-
604
602
  dealMatch.status = status;
605
603
  dealMatch.history.push(historyEntry);
606
-
607
604
  }
608
605
 
609
606
  // Add the deal
610
607
  else {
611
-
612
608
  self.deals.push({
613
609
  customer: customer,
614
610
  status: status,
615
611
  history: [historyEntry]
616
612
  });
617
-
618
613
  }
619
614
 
620
615
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",