@dhyasama/totem-models 9.27.0 → 9.28.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.
Files changed (2) hide show
  1. package/lib/Financials.js +35 -29
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -451,7 +451,7 @@ module.exports = function(mongoose, config) {
451
451
 
452
452
  if(conditions) {
453
453
 
454
- var recipients = snapshot.notifications.company.sendTo.map(function(sendTo) {
454
+ var recipients = snapshot.notifications.company.initial.sendTo.map(function(sendTo) {
455
455
  return sendTo.email;
456
456
  });
457
457
 
@@ -499,27 +499,30 @@ module.exports = function(mongoose, config) {
499
499
 
500
500
  _.each(financial.snapshots, function(snapshot) {
501
501
 
502
- var conditions = _.some(snapshot.notifications.company.reminders, function(reminder) {
503
- var hasSendTo = snapshot.notifications.company.reminders.sendTo && snapshot.notifications.company.reminders.sendTo.length > 0;
502
+ _.each(snapshot.notifications.company.reminders, function(reminder) {
503
+
504
+ var hasSendTo = reminder.sendTo && reminder.sendTo.length > 0;
504
505
  var hasSendOnLessThanNow = reminder.sendOn && reminder.sendOn < now;
505
506
  var hasSentOn = reminder.sentOn;
506
507
  var hasSentToQueue = reminder.sentToQueue;
507
- return hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
508
- });
509
508
 
510
- if(conditions) {
509
+ var conditions = hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
511
510
 
512
- var recipients = snapshot.notifications.company.sendTo.map(function(sendTo) {
513
- return sendTo.email;
514
- });
511
+ if(conditions) {
515
512
 
516
- results.push({
517
- 'financials': financial,
518
- 'uuid': snapshot.uuid,
519
- 'recipients': recipients
520
- });
513
+ var recipients = reminder.sendTo.map(function(sendTo) {
514
+ return sendTo.email;
515
+ });
521
516
 
522
- }
517
+ results.push({
518
+ 'financials': financial,
519
+ 'uuid': snapshot.uuid,
520
+ 'recipients': recipients
521
+ });
522
+
523
+ }
524
+
525
+ });
523
526
 
524
527
  });
525
528
 
@@ -557,27 +560,30 @@ module.exports = function(mongoose, config) {
557
560
 
558
561
  _.each(financial.snapshots, function(snapshot) {
559
562
 
560
- var conditions = _.some(snapshot.notifications.company.rejections, function(rejection) {
561
- var hasSendTo = snapshot.notifications.company.rejections.sendTo && snapshot.notifications.company.rejections.sendTo.length > 0;
563
+ _.each(snapshot.notifications.company.rejections, function(rejection) {
564
+
565
+ var hasSendTo = rejection.sendTo && rejection.sendTo.length > 0;
562
566
  var hasSendOnLessThanNow = rejection.sendOn && rejection.sendOn < now;
563
567
  var hasSentOn = rejection.sentOn;
564
568
  var hasSentToQueue = rejection.sentToQueue;
565
- return hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
566
- });
569
+
570
+ var conditions = hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
567
571
 
568
- if(conditions) {
572
+ if(conditions) {
569
573
 
570
- var recipients = snapshot.notifications.company.sendTo.map(function(sendTo) {
571
- return sendTo.email;
572
- });
574
+ var recipients = rejection.sendTo.map(function(sendTo) {
575
+ return sendTo.email;
576
+ });
573
577
 
574
- results.push({
575
- 'financials': financial,
576
- 'uuid': snapshot.uuid,
577
- 'recipients': recipients
578
- });
578
+ results.push({
579
+ 'financials': financial,
580
+ 'uuid': snapshot.uuid,
581
+ 'recipients': recipients
582
+ });
579
583
 
580
- }
584
+ }
585
+
586
+ });
581
587
 
582
588
  });
583
589
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "9.27.0",
3
+ "version": "9.28.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",