@dhyasama/totem-models 7.10.0 → 7.10.1

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.
Files changed (2) hide show
  1. package/lib/Financials.js +20 -4
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -274,8 +274,10 @@ module.exports = function(mongoose, config) {
274
274
  var now = new Date();
275
275
 
276
276
  var query = self.find({
277
+ "snapshots.notifications.company.initial.sendTo": { $ne: null },
277
278
  "snapshots.notifications.company.initial.sendOn": { $lte: now },
278
- "snapshots.notifications.company.initial.sentOn": null
279
+ "snapshots.notifications.company.initial.sentOn": null,
280
+ "snapshots.submittedOn": null
279
281
  });
280
282
 
281
283
  query.exec(function(err, result) {
@@ -287,7 +289,13 @@ module.exports = function(mongoose, config) {
287
289
  snapshots = _.flatten(snapshots);
288
290
 
289
291
  snapshots = _.filter(snapshots, function(snapshot) {
290
- return snapshot.notifications.company.initial.sendOn < now && !snapshot.notifications.company.initial.sentOn;
292
+
293
+ var bool = !!snapshot.notifications.company.initial.sendTo;
294
+ bool = bool && snapshot.notifications.company.initial.sendOn < now;
295
+ bool = bool && !snapshot.notifications.company.initial.sentOn;
296
+
297
+ return bool;
298
+
291
299
  });
292
300
 
293
301
  return cb(null, _.pluck(snapshots, 'uuid'));
@@ -302,8 +310,10 @@ module.exports = function(mongoose, config) {
302
310
  var now = new Date();
303
311
 
304
312
  var query = self.find({
313
+ "snapshots.notifications.company.reminder.sendTo": { $ne: null },
305
314
  "snapshots.notifications.company.reminder.sendOn": { $lte: now },
306
- "snapshots.notifications.company.reminder.sentOn": null
315
+ "snapshots.notifications.company.reminder.sentOn": null,
316
+ "snapshots.submittedOn": null
307
317
  });
308
318
 
309
319
  query.exec(function(err, result) {
@@ -315,7 +325,13 @@ module.exports = function(mongoose, config) {
315
325
  snapshots = _.flatten(snapshots);
316
326
 
317
327
  snapshots = _.filter(snapshots, function(snapshot) {
318
- return snapshot.notifications.company.reminder.sendOn < now && !snapshot.notifications.company.reminder.sentOn;
328
+
329
+ var bool = !!snapshot.notifications.company.reminder.sendTo;
330
+ bool = bool && snapshot.notifications.company.reminder.sendOn < now;
331
+ bool = bool && !snapshot.notifications.company.reminder.sentOn;
332
+
333
+ return bool;
334
+
319
335
  });
320
336
 
321
337
  return cb(null, _.pluck(snapshots, 'uuid'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.10.0",
3
+ "version": "7.10.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",