@dhyasama/totem-models 7.20.1 → 7.21.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/.npmignore ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
package/lib/Financials.js CHANGED
@@ -316,10 +316,14 @@ module.exports = function(mongoose, config) {
316
316
  var now = new Date();
317
317
 
318
318
  var query = self.find({
319
- "snapshots.notifications.company.sendTo": { $ne: null },
320
- "snapshots.notifications.company.initial.sendOn": { $lte: now },
321
- "snapshots.notifications.company.initial.sentOn": null,
322
- "snapshots.submittedOn": null
319
+ "snapshots": {
320
+ $elemMatch: {
321
+ "notifications.company.sendTo.email": { $ne: null },
322
+ "notifications.company.initial.sendOn": { $lte: now },
323
+ "notifications.company.initial.sentOn": null,
324
+ "submittedOn": null
325
+ }
326
+ }
323
327
  });
324
328
 
325
329
  query.exec(function(err, result) {
@@ -332,7 +336,7 @@ module.exports = function(mongoose, config) {
332
336
 
333
337
  snapshots = _.filter(snapshots, function(snapshot) {
334
338
 
335
- var bool = !!snapshot.notifications.company.sendTo;
339
+ var bool = !!snapshot.notifications.company.sendTo.email;
336
340
  bool = bool && snapshot.notifications.company.initial.sendOn < now;
337
341
  bool = bool && !snapshot.notifications.company.initial.sentOn;
338
342
 
@@ -352,10 +356,14 @@ module.exports = function(mongoose, config) {
352
356
  var now = new Date();
353
357
 
354
358
  var query = self.find({
355
- "snapshots.notifications.company.sendTo": { $ne: null },
356
- "snapshots.notifications.company.reminder.sendOn": { $lte: now },
357
- "snapshots.notifications.company.reminder.sentOn": null,
358
- "snapshots.submittedOn": null
359
+ "snapshots": {
360
+ $elemMatch: {
361
+ "notifications.company.sendTo.email": { $ne: null },
362
+ "notifications.company.reminder.sendOn": { $lte: now },
363
+ "notifications.company.reminder.sentOn": null,
364
+ "submittedOn": null
365
+ }
366
+ }
359
367
  });
360
368
 
361
369
  query.exec(function(err, result) {
@@ -368,7 +376,7 @@ module.exports = function(mongoose, config) {
368
376
 
369
377
  snapshots = _.filter(snapshots, function(snapshot) {
370
378
 
371
- var bool = !!snapshot.notifications.company.sendTo;
379
+ var bool = !!snapshot.notifications.company.sendTo.email;
372
380
  bool = bool && snapshot.notifications.company.reminder.sendOn < now;
373
381
  bool = bool && !snapshot.notifications.company.reminder.sentOn;
374
382