@dhyasama/totem-models 1.25.3 → 1.25.5

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.
@@ -217,7 +217,8 @@ module.exports = function(mongoose, config) {
217
217
  if (result.length == 0) return [];
218
218
  if (mongoose.Types.ObjectId.isValid(result[0].person)) return []; // not populated
219
219
 
220
- result = _.uniq(result, function(item) { return item.person._id.toString(); });
220
+ result = _.uniq(result, function(item) { return item.person._id ? item.person._id.toString() : ''; });
221
+ result = _.compact(result);
221
222
  result = _.sortBy(result, 'interactions.count');
222
223
  result.reverse();
223
224
  result = _.sortBy(result, 'name.full');
package/lib/Person.js CHANGED
@@ -141,10 +141,7 @@ module.exports = function(mongoose, config) {
141
141
  },
142
142
  notes: [ { type: Schema.ObjectId, ref: 'Note' } ]
143
143
  }
144
- ],
145
-
146
- // used for hiding non-people from the views (e.g. conference rooms that were created as people)
147
- doNotDisplay: { type: Boolean, default: false }
144
+ ]
148
145
 
149
146
  });
150
147
 
@@ -1018,8 +1015,6 @@ module.exports = function(mongoose, config) {
1018
1015
  on: new Date()
1019
1016
  };
1020
1017
 
1021
- console.log('Person.upsert -', currentPerson._id.toString(), currentPerson.entered.by, currentPerson.entered.by);
1022
-
1023
1018
  currentPerson.save(cb);
1024
1019
 
1025
1020
  };
@@ -1168,8 +1163,6 @@ module.exports = function(mongoose, config) {
1168
1163
  source.interactions.calendar = 0;
1169
1164
  });
1170
1165
 
1171
- console.log('Person.pre-save (1) -', self._id.toString(), self.calendarEventSummaries.length, self.sources.length);
1172
-
1173
1166
  _.each(self.calendarEventSummaries, function(ces) {
1174
1167
 
1175
1168
  var customerId = ces.totemCustomerId;
@@ -1203,22 +1196,16 @@ module.exports = function(mongoose, config) {
1203
1196
 
1204
1197
  });
1205
1198
 
1206
- console.log('Person.pre-save (2) -', self._id.toString(), self.calendarEventSummaries.length, self.sources.length);
1207
-
1208
1199
  // must have person and customer refs
1209
1200
  self.sources = _.reject(self.sources, function(source) {
1210
1201
  return !source.person || !source.customer;
1211
1202
  });
1212
1203
 
1213
- console.log('Person.pre-save (3) -', self._id.toString(), self.calendarEventSummaries.length, self.sources.length);
1214
-
1215
1204
  // dedupe
1216
1205
  self.sources = _.uniq(self.sources, function(source) {
1217
- return source.person.toString() && source.customer.toString();
1206
+ return source.person.toString() + source.customer.toString();
1218
1207
  });
1219
1208
 
1220
- console.log('Person.pre-save (4) -', self._id.toString(), self.calendarEventSummaries.length, self.sources.length);
1221
-
1222
1209
  next();
1223
1210
 
1224
1211
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.25.3",
3
+ "version": "1.25.5",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",