@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.
Files changed (2) hide show
  1. package/lib/Financials.js +24 -22
  2. 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 hasSendOnLessThanNow = snapshot.notifications.company.initial.sendOn < now;
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 && hasSendOnLessThanNow && hasNotBeenSentTo;
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
- 'submittedOn': null
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 hasSendOnLessThanNow = sendOnLessThanNow;
320
- var hasNotBeenSentTo = sendOnLessThanNow && !sendOnLessThanNow.sentOn;
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 && hasSendOnLessThanNow && hasNotBeenSentTo && hasNotBeenSubmitted;
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 hasSendOnLessThanNow = sendOnLessThanNow;
364
- var hasNotBeenSentTo = sendOnLessThanNow && !sendOnLessThanNow.sentOn;
364
+ var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.rejections, function(rejection) {
365
+ return rejection.sendOn < now && !rejection.sentOn;
366
+ });
365
367
 
366
- return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo;
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 bool = snapshot.managedServices;
413
- bool = bool && snapshot.submittedOn;
414
- bool = bool && !snapshot.reviewedOn;
414
+ var isManagedServices = snapshot.managedServices;
415
+ var isSubmitted = snapshot.submittedOn;
416
+ var isNotReviewed = !snapshot.reviewedOn;
415
417
 
416
- if(bool) {
418
+ if(isManagedServices && isSubmitted && isNotReviewed) {
417
419
  snapshots.push({
418
420
  organization: result.organization.name,
419
421
  snapshot: snapshot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.55.1",
3
+ "version": "7.57.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",