@dhyasama/totem-models 8.32.1 → 8.33.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 +5 -5
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -524,8 +524,8 @@ module.exports = function(mongoose, config) {
|
|
|
524
524
|
var query = self.find({
|
|
525
525
|
'snapshots': {
|
|
526
526
|
$elemMatch: {
|
|
527
|
-
'notifications.stakeholders.sendTo': { $
|
|
528
|
-
'notifications.stakeholders.organization': { $ne: null },
|
|
527
|
+
'notifications.stakeholders.sendTo.email': { $ne: null },
|
|
528
|
+
'notifications.stakeholders.sendTo.organization': { $ne: null },
|
|
529
529
|
'notifications.stakeholders.reminders.sendOn': { $lte: now },
|
|
530
530
|
'notifications.stakeholders.reminders.sentOn': null
|
|
531
531
|
}
|
|
@@ -544,13 +544,13 @@ module.exports = function(mongoose, config) {
|
|
|
544
544
|
|
|
545
545
|
async.each(snapshot.notifications.stakeholders, function(stakeholder, callback3) {
|
|
546
546
|
|
|
547
|
-
var
|
|
548
|
-
var hasOrganization = stakeholder.organization;
|
|
547
|
+
var hasEmail = stakeholder.sendTo && stakeholder.sendTo.email;
|
|
548
|
+
var hasOrganization = stakeholder.sendTo && stakeholder.sendTo.organization;
|
|
549
549
|
var hasUnsentSendOnLessThanNow = _.find(stakeholder.reminders, function(reminder) {
|
|
550
550
|
return reminder.sendOn < now && !reminder.sentOn;
|
|
551
551
|
});
|
|
552
552
|
|
|
553
|
-
if (!
|
|
553
|
+
if (!hasEmail || !hasOrganization || !hasUnsentSendOnLessThanNow) return callback3();
|
|
554
554
|
|
|
555
555
|
Account.findByEmail(stakeholder.sendTo.email, function(err, account) {
|
|
556
556
|
|