@dhyasama/totem-models 7.52.0 → 7.53.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 +6 -11
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -259,10 +259,6 @@ module.exports = function(mongoose, config) {
259
259
  var hasSendOnLessThanNow = snapshot.notifications.company.initial.sendOn < now;
260
260
  var hasNotBeenSentTo = !snapshot.notifications.company.initial.sentOn;
261
261
 
262
- //console.log(hasRecipients);
263
- //console.log(hasSendOnLessThanNow);
264
- //console.log(hasNotBeenSentTo);
265
-
266
262
  return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo;
267
263
 
268
264
  });
@@ -496,14 +492,12 @@ module.exports = function(mongoose, config) {
496
492
  snapshot.action = null;
497
493
  }
498
494
 
499
- else if(!_.isEmpty(snapshot.notifications.company.sendOn)) {
495
+ else if(!_.isEmpty(snapshot.notifications.company)) {
500
496
 
501
- var earliestSendOn = _.min(snapshot.notifications.company.sendOn, function(s) { return new Date(s.sendOn); });
502
- var latestSendOn = _.max(snapshot.notifications.company.sendOn, function(s) { return new Date(s.sendOn); });
503
- var latestSentOn = _.max(snapshot.notifications.company.sentOn, function(s) { return new Date(s.sentOn); })
497
+ var latestReminder = _.max(snapshot.notifications.company.reminders, function(r) { return new Date(r.sendOn); });
504
498
 
505
- var isScheduled = earliestSendOn.sendOn && moment().isBefore(moment(earliestSendOn.sendOn));
506
- var isOverdue = latestSendOn.sendOn && moment().subtract(14, 'd').isAfter(moment(latestSendOn.sendOn));
499
+ var isScheduled = snapshot.notifications.company.initial.sendOn && moment().isBefore(moment(snapshot.notifications.company.initial.sendOn));
500
+ var isOverdue = latestReminder.sendOn && moment().subtract(14, 'd').isAfter(moment(latestReminder.sendOn));
507
501
 
508
502
  if(isScheduled) {
509
503
  snapshot.status = 'Scheduled';
@@ -519,7 +513,8 @@ module.exports = function(mongoose, config) {
519
513
  snapshot.status = 'In Progress';
520
514
  if(isManagedServices && isSubmitted && !isRejected) snapshot.action = 'Review';
521
515
  else if(isManagedServices && isSubmitted && isRejected) snapshot.action = 'Rejected';
522
- else if(latestSentOn.status) snapshot.action = latestSentOn.status;
516
+ else if(latestReminder.sentOn) snapshot.action = latestReminder.status;
517
+ else snapshot.action = snapsot.notifications.company.initial.status;
523
518
  }
524
519
 
525
520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.52.0",
3
+ "version": "7.53.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",