@dhyasama/totem-models 7.55.1 → 7.57.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 +24 -22
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -272,10 +272,9 @@ module.exports = function(mongoose, config) {
|
|
|
272
272
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
273
273
|
|
|
274
274
|
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
275
|
-
var
|
|
276
|
-
var hasNotBeenSentTo = !snapshot.notifications.company.initial.sentOn;
|
|
275
|
+
var hasUnsentSendOnLessThanNow = snapshot.notifications.company.initial.sendOn < now && !snapshot.notifications.company.initial.sentOn;
|
|
277
276
|
|
|
278
|
-
return hasRecipients &&
|
|
277
|
+
return hasRecipients && hasUnsentSendOnLessThanNow;
|
|
279
278
|
|
|
280
279
|
});
|
|
281
280
|
|
|
@@ -296,7 +295,15 @@ module.exports = function(mongoose, config) {
|
|
|
296
295
|
'notifications.company.sendTo': { $gt: [] },
|
|
297
296
|
'notifications.company.reminders.sendOn': { $lte: now },
|
|
298
297
|
'notifications.company.reminders.sentOn': null,
|
|
299
|
-
|
|
298
|
+
"$or": [
|
|
299
|
+
{
|
|
300
|
+
"submittedOn": null,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"submittedOn": { $ne: null },
|
|
304
|
+
"rejection": { $ne: null }
|
|
305
|
+
}
|
|
306
|
+
]
|
|
300
307
|
}
|
|
301
308
|
}
|
|
302
309
|
});
|
|
@@ -311,16 +318,14 @@ module.exports = function(mongoose, config) {
|
|
|
311
318
|
|
|
312
319
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
313
320
|
|
|
314
|
-
var sendOnLessThanNow = _.find(snapshot.notifications.company.reminders, function(reminder) {
|
|
315
|
-
return reminder.sendOn < now;
|
|
316
|
-
});
|
|
317
|
-
|
|
318
321
|
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
319
|
-
var
|
|
320
|
-
|
|
322
|
+
var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.reminders, function(reminder) {
|
|
323
|
+
return reminder.sendOn < now && !reminder.sentOn;
|
|
324
|
+
});
|
|
321
325
|
var hasNotBeenSubmitted = !snapshot.submittedOn;
|
|
326
|
+
var hasBeenRejected = snapshot.submittedOn && snapshot.rejection;
|
|
322
327
|
|
|
323
|
-
return hasRecipients &&
|
|
328
|
+
return hasRecipients && hasUnsentSendOnLessThanNow && (hasNotBeenSubmitted || hasBeenRejected);
|
|
324
329
|
|
|
325
330
|
});
|
|
326
331
|
|
|
@@ -355,15 +360,12 @@ module.exports = function(mongoose, config) {
|
|
|
355
360
|
|
|
356
361
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
357
362
|
|
|
358
|
-
var sendOnLessThanNow = _.find(snapshot.notifications.company.rejections, function(rejection) {
|
|
359
|
-
return rejection.sendOn < now;
|
|
360
|
-
});
|
|
361
|
-
|
|
362
363
|
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
363
|
-
var
|
|
364
|
-
|
|
364
|
+
var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.rejections, function(rejection) {
|
|
365
|
+
return rejection.sendOn < now && !rejection.sentOn;
|
|
366
|
+
});
|
|
365
367
|
|
|
366
|
-
return hasRecipients &&
|
|
368
|
+
return hasRecipients && hasUnsentSendOnLessThanNow;
|
|
367
369
|
|
|
368
370
|
});
|
|
369
371
|
|
|
@@ -409,11 +411,11 @@ module.exports = function(mongoose, config) {
|
|
|
409
411
|
_.each(results, function(result) {
|
|
410
412
|
_.each(result.snapshots, function(snapshot) {
|
|
411
413
|
|
|
412
|
-
var
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
var isManagedServices = snapshot.managedServices;
|
|
415
|
+
var isSubmitted = snapshot.submittedOn;
|
|
416
|
+
var isNotReviewed = !snapshot.reviewedOn;
|
|
415
417
|
|
|
416
|
-
if(
|
|
418
|
+
if(isManagedServices && isSubmitted && isNotReviewed) {
|
|
417
419
|
snapshots.push({
|
|
418
420
|
organization: result.organization.name,
|
|
419
421
|
snapshot: snapshot
|