@dhyasama/totem-models 8.28.1 → 8.28.2
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 +20 -10
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -437,11 +437,17 @@ module.exports = function(mongoose, config) {
|
|
|
437
437
|
|
|
438
438
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
439
439
|
|
|
440
|
-
|
|
441
|
-
var hasOrganization = snapshot.notifications.stakeholders.organization;
|
|
442
|
-
var hasUnsentSendOnLessThanNow = snapshot.notifications.stakeholders.initial.sendOn < now && !snapshot.notifications.stakeholders.initial.sentOn;
|
|
440
|
+
snapshot = snapshot.toObject();
|
|
443
441
|
|
|
444
|
-
return
|
|
442
|
+
return _.some(snapshot.notifications.stakeholders, function(stakeholder) {
|
|
443
|
+
|
|
444
|
+
var hasRecipients = stakeholder.sendTo && stakeholder.sendTo.length > 0;
|
|
445
|
+
var hasOrganization = stakeholder.organization;
|
|
446
|
+
var hasUnsentSendOnLessThanNow = stakeholder.initial && stakeholder.initial.sendOn < now && !stakeholder.initial.sentOn;
|
|
447
|
+
|
|
448
|
+
return hasRecipients && hasOrganization && hasUnsentSendOnLessThanNow;
|
|
449
|
+
|
|
450
|
+
});
|
|
445
451
|
|
|
446
452
|
});
|
|
447
453
|
|
|
@@ -477,13 +483,17 @@ module.exports = function(mongoose, config) {
|
|
|
477
483
|
|
|
478
484
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
479
485
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
486
|
+
return _.some(snapshot.notifications.stakeholders, function(stakeholder) {
|
|
487
|
+
|
|
488
|
+
var hasRecipients = stakeholder.sendTo && stakeholder.sendTo.length > 0;
|
|
489
|
+
var hasOrganization = stakeholder.organization;
|
|
490
|
+
var hasUnsentSendOnLessThanNow = _.find(stakeholder.reminders, function(reminder) {
|
|
491
|
+
return reminder.sendOn < now && !reminder.sentOn;
|
|
492
|
+
});
|
|
485
493
|
|
|
486
|
-
|
|
494
|
+
return hasRecipients && hasOrganization && hasUnsentSendOnLessThanNow;
|
|
495
|
+
|
|
496
|
+
});
|
|
487
497
|
|
|
488
498
|
});
|
|
489
499
|
|