@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.
- package/lib/Financials.js +6 -11
- 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
|
|
495
|
+
else if(!_.isEmpty(snapshot.notifications.company)) {
|
|
500
496
|
|
|
501
|
-
var
|
|
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 =
|
|
506
|
-
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));
|
|
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(
|
|
516
|
+
else if(latestReminder.sentOn) snapshot.action = latestReminder.status;
|
|
517
|
+
else snapshot.action = snapsot.notifications.company.initial.status;
|
|
523
518
|
}
|
|
524
519
|
|
|
525
520
|
}
|