@dhyasama/totem-models 7.57.0 → 7.58.0

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/lib/Financials.js CHANGED
@@ -322,10 +322,10 @@ module.exports = function(mongoose, config) {
322
322
  var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.reminders, function(reminder) {
323
323
  return reminder.sendOn < now && !reminder.sentOn;
324
324
  });
325
- var hasNotBeenSubmitted = !snapshot.submittedOn;
326
- var hasBeenRejected = snapshot.submittedOn && snapshot.rejection;
325
+ var hasBeenSubmitted = snapshot.submittedOn;
326
+ var hasBeenRejected = snapshot.rejection;
327
327
 
328
- return hasRecipients && hasUnsentSendOnLessThanNow && (hasNotBeenSubmitted || hasBeenRejected);
328
+ return hasRecipients && hasUnsentSendOnLessThanNow && ((!hasBeenSubmitted) || (hasBeenSubmitted && hasBeenRejected));
329
329
 
330
330
  });
331
331
 
@@ -345,7 +345,9 @@ module.exports = function(mongoose, config) {
345
345
  $elemMatch: {
346
346
  'notifications.company.sendTo': { $gt: [] },
347
347
  'notifications.company.rejections.sendOn': { $lte: now },
348
- 'notifications.company.rejections.sentOn': null
348
+ 'notifications.company.rejections.sentOn': null,
349
+ "submittedOn": { $ne: null },
350
+ "rejection": { $ne: null }
349
351
  }
350
352
  }
351
353
  });
@@ -364,8 +366,10 @@ module.exports = function(mongoose, config) {
364
366
  var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.rejections, function(rejection) {
365
367
  return rejection.sendOn < now && !rejection.sentOn;
366
368
  });
369
+ var hasBeenSubmitted = snapshot.submittedOn;
370
+ var hasBeenRejected = snapshot.rejection;
367
371
 
368
- return hasRecipients && hasUnsentSendOnLessThanNow;
372
+ return hasRecipients && hasUnsentSendOnLessThanNow && hasBeenSubmitted && hasBeenRejected;
369
373
 
370
374
  });
371
375
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.57.0",
3
+ "version": "7.58.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",