@dhyasama/totem-models 9.42.0 → 9.43.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 +19 -3
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -319,7 +319,7 @@ module.exports = function(mongoose, config) {
|
|
|
319
319
|
'snapshots.uuid': uuid
|
|
320
320
|
});
|
|
321
321
|
|
|
322
|
-
query.populate('organization', 'name logoUrl');
|
|
322
|
+
query.populate('organization', 'name logoUrl website');
|
|
323
323
|
query.populate('customer');
|
|
324
324
|
query.populate('snapshots.documents.document');
|
|
325
325
|
|
|
@@ -601,13 +601,15 @@ module.exports = function(mongoose, config) {
|
|
|
601
601
|
}
|
|
602
602
|
});
|
|
603
603
|
|
|
604
|
-
query.exec(function(err,
|
|
604
|
+
query.exec(function(err, financials) {
|
|
605
605
|
|
|
606
606
|
if (err) { return cb(err, null); }
|
|
607
607
|
|
|
608
|
+
console.log('getStakeholderInitialToSend financials.length: ' + financials.length);
|
|
609
|
+
|
|
608
610
|
let results = [];
|
|
609
611
|
|
|
610
|
-
_.each(
|
|
612
|
+
_.each(financials, function(financial) {
|
|
611
613
|
|
|
612
614
|
let result = {
|
|
613
615
|
'financials': financial,
|
|
@@ -618,11 +620,15 @@ module.exports = function(mongoose, config) {
|
|
|
618
620
|
'stakeholder': null // todo - legacy, to be removed
|
|
619
621
|
};
|
|
620
622
|
|
|
623
|
+
console.log('getStakeholderInitialToSend financials.snapshots.length: ' + financials.snapshots.length);
|
|
624
|
+
|
|
621
625
|
_.each(financial.snapshots, function(snapshot) {
|
|
622
626
|
|
|
623
627
|
result.snapshotUUID = snapshot.uuid;
|
|
624
628
|
result.uuid = snapshot.uuid; // legacy, tbr
|
|
625
629
|
|
|
630
|
+
console.log('getStakeholderInitialToSend snapshot.notifications.stakeholders.length: ' + snapshot.notifications.stakeholders.length);
|
|
631
|
+
|
|
626
632
|
_.each(snapshot.notifications.stakeholders, function(stakeholder) {
|
|
627
633
|
|
|
628
634
|
const hasSendToEmail = stakeholder.sendTo && stakeholder.sendTo.email;
|
|
@@ -633,6 +639,8 @@ module.exports = function(mongoose, config) {
|
|
|
633
639
|
|
|
634
640
|
if (conditionsMet) {
|
|
635
641
|
|
|
642
|
+
console.log('getStakeholderInitialToSend conditions met');
|
|
643
|
+
|
|
636
644
|
result.stakeholderIdsToNotify.push(stakeholder._id);
|
|
637
645
|
|
|
638
646
|
// todo - legacy, to be removed
|
|
@@ -641,6 +649,14 @@ module.exports = function(mongoose, config) {
|
|
|
641
649
|
|
|
642
650
|
}
|
|
643
651
|
|
|
652
|
+
else {
|
|
653
|
+
console.log('getStakeholderInitialToSend conditions not met');
|
|
654
|
+
console.log('getStakeholderInitialToSend hasSendToEmail: ' + hasSendToEmail);
|
|
655
|
+
console.log('getStakeholderInitialToSend sendOnLessThanNow: ' + sendOnLessThanNow);
|
|
656
|
+
console.log('getStakeholderInitialToSend sentOn: ' + sentOn);
|
|
657
|
+
console.log('getStakeholderInitialToSend sentToQueue: ' + sentToQueue);
|
|
658
|
+
}
|
|
659
|
+
|
|
644
660
|
});
|
|
645
661
|
|
|
646
662
|
});
|