@dhyasama/totem-models 7.52.1 → 7.53.1
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 +6 -7
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -492,14 +492,12 @@ module.exports = function(mongoose, config) {
|
|
|
492
492
|
snapshot.action = null;
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
else if(!_.isEmpty(snapshot.notifications.company
|
|
495
|
+
else if(!_.isEmpty(snapshot.notifications.company)) {
|
|
496
496
|
|
|
497
|
-
var
|
|
498
|
-
var latestSendOn = _.max(snapshot.notifications.company.sendOn, function(s) { return new Date(s.sendOn); });
|
|
499
|
-
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); });
|
|
500
498
|
|
|
501
|
-
var isScheduled =
|
|
502
|
-
var isOverdue =
|
|
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));
|
|
503
501
|
|
|
504
502
|
if(isScheduled) {
|
|
505
503
|
snapshot.status = 'Scheduled';
|
|
@@ -515,7 +513,8 @@ module.exports = function(mongoose, config) {
|
|
|
515
513
|
snapshot.status = 'In Progress';
|
|
516
514
|
if(isManagedServices && isSubmitted && !isRejected) snapshot.action = 'Review';
|
|
517
515
|
else if(isManagedServices && isSubmitted && isRejected) snapshot.action = 'Rejected';
|
|
518
|
-
else if(
|
|
516
|
+
else if(latestReminder.sentOn) snapshot.action = latestReminder.status;
|
|
517
|
+
else snapshot.action = snapshot.notifications.company.initial.status;
|
|
519
518
|
}
|
|
520
519
|
|
|
521
520
|
}
|