@dhyasama/totem-models 4.5.1 → 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.
@@ -389,7 +389,7 @@ module.exports = function(mongoose, config) {
389
389
  // Don't return statuses for a different customer
390
390
  if (self._id.toString() != config.CUSTOMER_ID) return statuses;
391
391
 
392
- // Backwards schema compatability
392
+ // Backwards schema compatibility
393
393
  else if (!self.customer.deals) return statuses;
394
394
 
395
395
  // Deals aren't on for customer
@@ -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,12 +1,12 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "4.5.1",
3
+ "version": "4.5.3",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
- "test": "NODE_ENV=test node ./changeBSON && mocha -R spec -t 15000"
9
+ "test": "NODE_ENV=test node ./changeBSON && mocha -R spec -t 15000 --exit"
10
10
  },
11
11
  "publishConfig": {
12
12
  "registry": "https://registry.npmjs.org/"