@dhyasama/totem-models 8.32.0 → 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 CHANGED
@@ -493,7 +493,7 @@ module.exports = function(mongoose, config) {
493
493
 
494
494
  results.push({
495
495
  'uuid': snapshot.uuid,
496
- 'recipients': stakeholder.sendTo.email
496
+ 'recipients': [stakeholder.sendTo.email]
497
497
  });
498
498
 
499
499
  return callback3();
@@ -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': { $gt: [] },
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 hasRecipients = stakeholder.sendTo && stakeholder.sendTo.length > 0;
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 (!hasRecipients || !hasOrganization || !hasUnsentSendOnLessThanNow) return callback3();
553
+ if (!hasEmail || !hasOrganization || !hasUnsentSendOnLessThanNow) return callback3();
554
554
 
555
555
  Account.findByEmail(stakeholder.sendTo.email, function(err, account) {
556
556
 
@@ -561,7 +561,7 @@ module.exports = function(mongoose, config) {
561
561
 
562
562
  results.push({
563
563
  'uuid': snapshot.uuid,
564
- 'recipients': stakeholder.sendTo.email
564
+ 'recipients': [stakeholder.sendTo.email]
565
565
  });
566
566
 
567
567
  return callback3();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.32.0",
3
+ "version": "8.33.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",