@dhyasama/totem-models 8.28.0 → 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 +22 -10
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -269,6 +269,8 @@ module.exports = function(mongoose, config) {
|
|
|
269
269
|
{ 'snapshots.notifications.company.initial.postmarkMessageId': postmarkMessageId },
|
|
270
270
|
{ 'snapshots.notifications.company.reminders.postmarkMessageId': postmarkMessageId },
|
|
271
271
|
{ 'snapshots.notifications.company.rejections.postmarkMessageId': postmarkMessageId },
|
|
272
|
+
{ 'snapshots.notifications.stakeholders.initial.postmarkMessageId': postmarkMessageId },
|
|
273
|
+
{ 'snapshots.notifications.stakeholders.reminders.postmarkMessageId': postmarkMessageId }
|
|
272
274
|
]
|
|
273
275
|
});
|
|
274
276
|
|
|
@@ -435,11 +437,17 @@ module.exports = function(mongoose, config) {
|
|
|
435
437
|
|
|
436
438
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
437
439
|
|
|
438
|
-
|
|
439
|
-
var hasOrganization = snapshot.notifications.stakeholders.organization;
|
|
440
|
-
var hasUnsentSendOnLessThanNow = snapshot.notifications.stakeholders.initial.sendOn < now && !snapshot.notifications.stakeholders.initial.sentOn;
|
|
440
|
+
snapshot = snapshot.toObject();
|
|
441
441
|
|
|
442
|
-
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
|
+
});
|
|
443
451
|
|
|
444
452
|
});
|
|
445
453
|
|
|
@@ -475,13 +483,17 @@ module.exports = function(mongoose, config) {
|
|
|
475
483
|
|
|
476
484
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
477
485
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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
|
+
});
|
|
483
493
|
|
|
484
|
-
|
|
494
|
+
return hasRecipients && hasOrganization && hasUnsentSendOnLessThanNow;
|
|
495
|
+
|
|
496
|
+
});
|
|
485
497
|
|
|
486
498
|
});
|
|
487
499
|
|