@dhyasama/totem-models 8.7.0 → 8.8.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 +162 -128
- package/lib/Round.js +12 -6
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -27,8 +27,6 @@ module.exports = function(mongoose, config) {
|
|
|
27
27
|
|
|
28
28
|
uuid: { type: String },
|
|
29
29
|
|
|
30
|
-
campaignId: { type: String },
|
|
31
|
-
|
|
32
30
|
managedServices: { type: Boolean, default: false, required: true },
|
|
33
31
|
|
|
34
32
|
status: { type: String },
|
|
@@ -115,7 +113,9 @@ module.exports = function(mongoose, config) {
|
|
|
115
113
|
|
|
116
114
|
submittedOn: { type: Date, index: false },
|
|
117
115
|
submittedBy: { type: String, trim: true },
|
|
116
|
+
|
|
118
117
|
reviewedOn: { type: Date, index: false },
|
|
118
|
+
rejection: { type: String, trim: true },
|
|
119
119
|
|
|
120
120
|
notifications: {
|
|
121
121
|
|
|
@@ -133,17 +133,18 @@ module.exports = function(mongoose, config) {
|
|
|
133
133
|
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
134
134
|
},
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
reminders: [{
|
|
137
137
|
sendOn: { type: Date, required: false },
|
|
138
138
|
sentOn: { type: Date, required: false },
|
|
139
139
|
postmarkMessageId: { type: String, trim: true },
|
|
140
140
|
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
141
|
-
},
|
|
141
|
+
}],
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
rejections: [{
|
|
144
|
+
sendOn: { type: Date, required: false },
|
|
145
|
+
sentOn: { type: Date, required: false },
|
|
145
146
|
postmarkMessageId: { type: String, trim: true },
|
|
146
|
-
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
147
|
+
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
147
148
|
}]
|
|
148
149
|
|
|
149
150
|
},
|
|
@@ -180,8 +181,6 @@ module.exports = function(mongoose, config) {
|
|
|
180
181
|
|
|
181
182
|
});
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
185
184
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
186
185
|
// METHODS
|
|
187
186
|
// Methods operate on a single document
|
|
@@ -196,9 +195,9 @@ module.exports = function(mongoose, config) {
|
|
|
196
195
|
|
|
197
196
|
Financials.statics.getByOrg = function getByOrg(customerId, orgId, cb) {
|
|
198
197
|
|
|
199
|
-
|
|
198
|
+
var self = this;
|
|
200
199
|
|
|
201
|
-
|
|
200
|
+
var query = self.findOne({
|
|
202
201
|
'customer': customerId,
|
|
203
202
|
'organization': orgId
|
|
204
203
|
}).populate({
|
|
@@ -206,34 +205,15 @@ module.exports = function(mongoose, config) {
|
|
|
206
205
|
match: { customer: customerId }
|
|
207
206
|
});
|
|
208
207
|
|
|
209
|
-
// No need to scrub because population matched on customer id
|
|
210
|
-
|
|
211
|
-
query.exec(cb);
|
|
212
|
-
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
Financials.statics.getByPostmarkMessageId = function getByPostmarkMessageId(postmarkMessageId, cb) {
|
|
216
|
-
|
|
217
|
-
let self = this;
|
|
218
|
-
|
|
219
|
-
let query = self.findOne({
|
|
220
|
-
$or: [
|
|
221
|
-
{ 'snapshots.notifications.company.initial.postmarkMessageId': postmarkMessageId },
|
|
222
|
-
{ 'snapshots.notifications.company.reminder.postmarkMessageId': postmarkMessageId }
|
|
223
|
-
]
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
// No population so no need to scrub
|
|
227
|
-
|
|
228
208
|
query.exec(cb);
|
|
229
209
|
|
|
230
210
|
};
|
|
231
211
|
|
|
232
212
|
Financials.statics.getByUUID = function getByUUID(customerId, uuid, cb) {
|
|
233
213
|
|
|
234
|
-
|
|
214
|
+
var self = this;
|
|
235
215
|
|
|
236
|
-
|
|
216
|
+
var query = self.findOne({
|
|
237
217
|
'customer': customerId,
|
|
238
218
|
'snapshots.uuid': uuid
|
|
239
219
|
});
|
|
@@ -245,129 +225,150 @@ module.exports = function(mongoose, config) {
|
|
|
245
225
|
match: { customer: customerId }
|
|
246
226
|
});
|
|
247
227
|
|
|
248
|
-
// No need to scrub because population matched on customer id
|
|
249
|
-
|
|
250
228
|
query.exec(cb);
|
|
251
229
|
|
|
252
230
|
};
|
|
253
231
|
|
|
254
|
-
Financials.statics.
|
|
255
|
-
|
|
256
|
-
let self = this;
|
|
257
|
-
|
|
258
|
-
let query = self.find({
|
|
259
|
-
'customer': customerId,
|
|
260
|
-
'notification.contact.exclude': { $ne: true }, // null, false, or non-existing field
|
|
261
|
-
'notification.contact.email': { $ne: null } // field exists and has a value
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
// No population so no need to scrub
|
|
265
|
-
|
|
266
|
-
query.exec(cb);
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
Financials.statics.getForCustomer = function getForCustomer(customerId, cb) {
|
|
232
|
+
Financials.statics.getByPostmarkMessageId = function getByPostmarkMessageId(postmarkMessageId, cb) {
|
|
271
233
|
|
|
272
|
-
|
|
234
|
+
var self = this;
|
|
273
235
|
|
|
274
|
-
|
|
275
|
-
|
|
236
|
+
var query = self.findOne({
|
|
237
|
+
$or: [
|
|
238
|
+
{ 'snapshots.notifications.company.initial.postmarkMessageId': postmarkMessageId },
|
|
239
|
+
{ 'snapshots.notifications.company.reminders.postmarkMessageId': postmarkMessageId },
|
|
240
|
+
{ 'snapshots.notifications.company.rejections.postmarkMessageId': postmarkMessageId },
|
|
241
|
+
]
|
|
276
242
|
});
|
|
277
243
|
|
|
278
|
-
// No population so no need to scrub
|
|
279
|
-
|
|
280
244
|
query.exec(cb);
|
|
281
245
|
|
|
282
246
|
};
|
|
283
247
|
|
|
284
|
-
Financials.statics.
|
|
248
|
+
Financials.statics.getInitialUUIDsToSend = function getInitialUUIDsToSend(cb) {
|
|
285
249
|
|
|
286
|
-
|
|
250
|
+
var self = this;
|
|
251
|
+
var now = new Date();
|
|
287
252
|
|
|
288
|
-
|
|
289
|
-
'customer': customerId,
|
|
253
|
+
var query = self.find({
|
|
290
254
|
'snapshots': {
|
|
291
255
|
$elemMatch: {
|
|
292
|
-
'
|
|
293
|
-
'
|
|
294
|
-
'
|
|
256
|
+
'notifications.company.sendTo': { $gt: [] },
|
|
257
|
+
'notifications.company.initial.sendOn': { $lte: now },
|
|
258
|
+
'notifications.company.initial.sentOn': null
|
|
295
259
|
}
|
|
296
260
|
}
|
|
297
261
|
});
|
|
298
262
|
|
|
299
|
-
// No population so no need to scrub
|
|
300
|
-
|
|
301
263
|
query.exec(function(err, result) {
|
|
302
264
|
|
|
303
|
-
|
|
265
|
+
if (err) { return cb(err, null); }
|
|
266
|
+
|
|
267
|
+
var snapshots = _.pluck(result || [], 'snapshots');
|
|
268
|
+
|
|
304
269
|
snapshots = _.flatten(snapshots);
|
|
305
270
|
|
|
306
271
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
307
272
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
bool = bool && !snapshot.reviewedOn;
|
|
273
|
+
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
274
|
+
var hasUnsentSendOnLessThanNow = snapshot.notifications.company.initial.sendOn < now && !snapshot.notifications.company.initial.sentOn;
|
|
311
275
|
|
|
312
|
-
return
|
|
276
|
+
return hasRecipients && hasUnsentSendOnLessThanNow;
|
|
313
277
|
|
|
314
278
|
});
|
|
315
279
|
|
|
316
|
-
|
|
317
|
-
return cb(null, snapshots);
|
|
280
|
+
return cb(null, _.pluck(snapshots, 'uuid'));
|
|
318
281
|
|
|
319
282
|
});
|
|
320
283
|
|
|
321
284
|
};
|
|
322
285
|
|
|
323
|
-
Financials.statics.
|
|
286
|
+
Financials.statics.getReminderUUIDsToSend = function getReminderUUIDsToSend(cb) {
|
|
324
287
|
|
|
325
|
-
|
|
288
|
+
var self = this;
|
|
289
|
+
var now = new Date();
|
|
326
290
|
|
|
327
|
-
|
|
328
|
-
'snapshots
|
|
291
|
+
var query = self.find({
|
|
292
|
+
'snapshots': {
|
|
293
|
+
$elemMatch: {
|
|
294
|
+
'notifications.company.sendTo': { $gt: [] },
|
|
295
|
+
'notifications.company.reminders.sendOn': { $lte: now },
|
|
296
|
+
'notifications.company.reminders.sentOn': null,
|
|
297
|
+
"$or": [
|
|
298
|
+
{
|
|
299
|
+
"submittedOn": null,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"submittedOn": { $ne: null },
|
|
303
|
+
"rejection": { $ne: null }
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
329
308
|
});
|
|
330
309
|
|
|
331
|
-
query.
|
|
332
|
-
query.populate('customer', 'name logoUrl customer.totemUrl');
|
|
310
|
+
query.exec(function(err, result) {
|
|
333
311
|
|
|
334
|
-
|
|
312
|
+
if (err) { return cb(err, null); }
|
|
313
|
+
|
|
314
|
+
var snapshots = _.pluck(result || [], 'snapshots');
|
|
315
|
+
|
|
316
|
+
snapshots = _.flatten(snapshots);
|
|
317
|
+
|
|
318
|
+
snapshots = _.filter(snapshots, function(snapshot) {
|
|
319
|
+
|
|
320
|
+
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
321
|
+
var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.reminders, function(reminder) {
|
|
322
|
+
return reminder.sendOn < now && !reminder.sentOn;
|
|
323
|
+
});
|
|
324
|
+
var hasBeenSubmitted = snapshot.submittedOn;
|
|
325
|
+
var hasBeenRejected = snapshot.rejection;
|
|
326
|
+
|
|
327
|
+
return hasRecipients && hasUnsentSendOnLessThanNow && ((!hasBeenSubmitted) || (hasBeenSubmitted && hasBeenRejected));
|
|
328
|
+
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
return cb(null, _.pluck(snapshots, 'uuid'));
|
|
332
|
+
|
|
333
|
+
});
|
|
335
334
|
|
|
336
335
|
};
|
|
337
336
|
|
|
338
|
-
Financials.statics.
|
|
337
|
+
Financials.statics.getRejectionUUIDsToSend = function getRejectionUUIDsToSend(cb) {
|
|
339
338
|
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
var self = this;
|
|
340
|
+
var now = new Date();
|
|
342
341
|
|
|
343
|
-
|
|
342
|
+
var query = self.find({
|
|
344
343
|
'snapshots': {
|
|
345
344
|
$elemMatch: {
|
|
346
345
|
'notifications.company.sendTo': { $gt: [] },
|
|
347
|
-
'notifications.company.
|
|
348
|
-
'notifications.company.
|
|
349
|
-
|
|
346
|
+
'notifications.company.rejections.sendOn': { $lte: now },
|
|
347
|
+
'notifications.company.rejections.sentOn': null,
|
|
348
|
+
"submittedOn": { $ne: null },
|
|
349
|
+
"rejection": { $ne: null }
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
-
// No population so no need to scrub
|
|
355
|
-
|
|
356
354
|
query.exec(function(err, result) {
|
|
357
355
|
|
|
358
356
|
if (err) { return cb(err, null); }
|
|
359
357
|
|
|
360
|
-
|
|
358
|
+
var snapshots = _.pluck(result || [], 'snapshots');
|
|
361
359
|
|
|
362
360
|
snapshots = _.flatten(snapshots);
|
|
363
361
|
|
|
364
362
|
snapshots = _.filter(snapshots, function(snapshot) {
|
|
365
363
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
|
|
365
|
+
var hasUnsentSendOnLessThanNow = _.find(snapshot.notifications.company.rejections, function(rejection) {
|
|
366
|
+
return rejection.sendOn < now && !rejection.sentOn;
|
|
367
|
+
});
|
|
368
|
+
var hasBeenSubmitted = snapshot.submittedOn;
|
|
369
|
+
var hasBeenRejected = snapshot.rejection;
|
|
369
370
|
|
|
370
|
-
return
|
|
371
|
+
return hasRecipients && hasUnsentSendOnLessThanNow && hasBeenSubmitted && hasBeenRejected;
|
|
371
372
|
|
|
372
373
|
});
|
|
373
374
|
|
|
@@ -377,46 +378,76 @@ module.exports = function(mongoose, config) {
|
|
|
377
378
|
|
|
378
379
|
};
|
|
379
380
|
|
|
380
|
-
Financials.statics.
|
|
381
|
+
Financials.statics.getForCustomer = function getForCustomer(customerId, cb) {
|
|
381
382
|
|
|
382
|
-
|
|
383
|
-
let now = new Date();
|
|
383
|
+
var self = this;
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
var query = self.find({
|
|
386
|
+
'customer': customerId
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
query.exec(cb);
|
|
390
|
+
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
Financials.statics.getManagedServicesForReview = function getManagedServicesForReview(customerId, cb) {
|
|
394
|
+
|
|
395
|
+
var self = this;
|
|
396
|
+
|
|
397
|
+
var query = self.find({
|
|
398
|
+
'customer': customerId,
|
|
386
399
|
'snapshots': {
|
|
387
400
|
$elemMatch: {
|
|
388
|
-
'
|
|
389
|
-
'
|
|
390
|
-
'
|
|
391
|
-
'submittedOn': null
|
|
401
|
+
'managedServices': true,
|
|
402
|
+
'submittedOn': { $ne: null },
|
|
403
|
+
'reviewedOn': null
|
|
392
404
|
}
|
|
393
405
|
}
|
|
394
406
|
});
|
|
395
407
|
|
|
396
|
-
|
|
408
|
+
query.populate('organization', 'name');
|
|
397
409
|
|
|
398
|
-
query.exec(function(err,
|
|
410
|
+
query.exec(function(err, results) {
|
|
399
411
|
|
|
400
|
-
|
|
412
|
+
var snapshots = [];
|
|
401
413
|
|
|
402
|
-
|
|
414
|
+
_.each(results, function(result) {
|
|
415
|
+
_.each(result.snapshots, function(snapshot) {
|
|
403
416
|
|
|
404
|
-
|
|
417
|
+
var isManagedServices = snapshot.managedServices;
|
|
418
|
+
var isSubmitted = snapshot.submittedOn;
|
|
419
|
+
var isNotReviewed = !snapshot.reviewedOn;
|
|
405
420
|
|
|
406
|
-
|
|
421
|
+
if(isManagedServices && isSubmitted && isNotReviewed) {
|
|
422
|
+
snapshots.push({
|
|
423
|
+
organization: result.organization.name,
|
|
424
|
+
snapshot: snapshot
|
|
425
|
+
});
|
|
426
|
+
}
|
|
407
427
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
bool = bool && !snapshot.notifications.company.reminder.sentOn;
|
|
428
|
+
});
|
|
429
|
+
});
|
|
411
430
|
|
|
412
|
-
|
|
431
|
+
if (err) { return cb(err, null); }
|
|
432
|
+
return cb(null, snapshots);
|
|
413
433
|
|
|
414
|
-
|
|
434
|
+
});
|
|
415
435
|
|
|
416
|
-
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
Financials.statics.getToSend = function getToSend(uuid, cb) {
|
|
417
439
|
|
|
440
|
+
var self = this;
|
|
441
|
+
|
|
442
|
+
var query = self.findOne({
|
|
443
|
+
'snapshots.uuid': uuid
|
|
418
444
|
});
|
|
419
445
|
|
|
446
|
+
query.populate('organization', 'name logoUrl');
|
|
447
|
+
query.populate('customer', 'name logoUrl customer.totemUrl');
|
|
448
|
+
|
|
449
|
+
query.exec(cb);
|
|
450
|
+
|
|
420
451
|
};
|
|
421
452
|
|
|
422
453
|
Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
|
|
@@ -424,9 +455,7 @@ module.exports = function(mongoose, config) {
|
|
|
424
455
|
// this is only used to wipe out financials created by the google sheet import process
|
|
425
456
|
// we do NOT want to delete any financials submitted via forms generated directly from the app
|
|
426
457
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
// No population so no need to scrub
|
|
458
|
+
var self = this;
|
|
430
459
|
|
|
431
460
|
self
|
|
432
461
|
.update(
|
|
@@ -439,7 +468,6 @@ module.exports = function(mongoose, config) {
|
|
|
439
468
|
|
|
440
469
|
Financials.statics.upsert = function upsert(financials, cb) {
|
|
441
470
|
|
|
442
|
-
if (!cb) { throw new Error('cb is required'); }
|
|
443
471
|
if (!financials) { return cb(new Error('financials is required'), null); }
|
|
444
472
|
|
|
445
473
|
// Required for mixed types
|
|
@@ -456,8 +484,6 @@ module.exports = function(mongoose, config) {
|
|
|
456
484
|
financials.markModified('investingActivities.breakdown');
|
|
457
485
|
financials.markModified('financingActivities.breakdown');
|
|
458
486
|
|
|
459
|
-
// No population so no need to scrub
|
|
460
|
-
|
|
461
487
|
financials.save(cb);
|
|
462
488
|
|
|
463
489
|
};
|
|
@@ -478,17 +504,24 @@ module.exports = function(mongoose, config) {
|
|
|
478
504
|
|
|
479
505
|
if(!snapshot) return;
|
|
480
506
|
|
|
507
|
+
var isManagedServices = snapshot.managedServices;
|
|
508
|
+
var isSubmitted = snapshot.submittedOn;
|
|
509
|
+
var isReviewed = snapshot.reviewedOn;
|
|
510
|
+
var isRejected = snapshot.rejection;
|
|
511
|
+
|
|
481
512
|
// no uuid means the data was captured from the google sheet
|
|
482
|
-
if((!snapshot.uuid) || (!
|
|
513
|
+
if((!snapshot.uuid) || (!isManagedServices && isSubmitted) || (isManagedServices && isReviewed)) {
|
|
483
514
|
snapshot.status = 'Completed';
|
|
484
515
|
snapshot.action = null;
|
|
485
516
|
}
|
|
486
517
|
|
|
487
|
-
else if(snapshot.notifications.company.initial.sendOn) {
|
|
518
|
+
else if(snapshot.notifications.company && snapshot.notifications.company.initial && snapshot.notifications.company.initial.sendOn) {
|
|
519
|
+
|
|
520
|
+
var latestReminder = _.max(snapshot.notifications.company.reminders, function(r) { return new Date(r.sendOn); });
|
|
521
|
+
|
|
522
|
+
var isScheduled = snapshot.notifications.company.initial.sendOn && moment().isBefore(moment(snapshot.notifications.company.initial.sendOn));
|
|
523
|
+
var isOverdue = latestReminder.sendOn && moment().subtract(14, 'd').isAfter(moment(latestReminder.sendOn));
|
|
488
524
|
|
|
489
|
-
var isScheduled = moment().isBefore(moment(snapshot.notifications.company.initial.sendOn));
|
|
490
|
-
var isOverdue = moment().subtract(30, 'd').isAfter(moment(snapshot.notifications.company.reminder.sendOn || snapshot.notifications.company.initial.sendOn));
|
|
491
|
-
|
|
492
525
|
if(isScheduled) {
|
|
493
526
|
snapshot.status = 'Scheduled';
|
|
494
527
|
snapshot.action = null;
|
|
@@ -501,9 +534,10 @@ module.exports = function(mongoose, config) {
|
|
|
501
534
|
|
|
502
535
|
else {
|
|
503
536
|
snapshot.status = 'In Progress';
|
|
504
|
-
if(
|
|
505
|
-
else if(
|
|
506
|
-
else if
|
|
537
|
+
if(isManagedServices && isSubmitted && !isRejected) snapshot.action = 'Review';
|
|
538
|
+
else if(isManagedServices && isSubmitted && isRejected) snapshot.action = 'Rejected';
|
|
539
|
+
else if(latestReminder.sentOn) snapshot.action = latestReminder.status;
|
|
540
|
+
else snapshot.action = snapshot.notifications.company.initial.status;
|
|
507
541
|
}
|
|
508
542
|
|
|
509
543
|
}
|
|
@@ -523,8 +557,8 @@ module.exports = function(mongoose, config) {
|
|
|
523
557
|
// CONFIG
|
|
524
558
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
525
559
|
|
|
526
|
-
Financials.set('usePushEach', true);
|
|
527
560
|
Financials.set('toJSON', { virtuals: true });
|
|
561
|
+
Financials.set('usePushEach', true);
|
|
528
562
|
Financials.set('autoIndex', false);
|
|
529
563
|
|
|
530
564
|
Financials.on('index', function(err) { console.log('error building financials indexes: ' + err); });
|
package/lib/Round.js
CHANGED
|
@@ -672,9 +672,12 @@ module.exports = function(mongoose, config) {
|
|
|
672
672
|
let error = checkForUnpopulatedData(rounds, 'Round.getPortfolioByFund');
|
|
673
673
|
if (error) return cb(error, null);
|
|
674
674
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
if (!options.isWorkerProcess) {
|
|
676
|
+
_.each(rounds, function(round) {
|
|
677
|
+
round.organization = helpers.cleanOrg(round.organization, options.CUSTOMER_ID);
|
|
678
|
+
if(round.organization.filters) console.log(round.organization.filters.toObject());
|
|
679
|
+
});
|
|
680
|
+
}
|
|
678
681
|
|
|
679
682
|
return cb(null, buildPortfolio(rounds, [fundId]));
|
|
680
683
|
|
|
@@ -733,9 +736,12 @@ module.exports = function(mongoose, config) {
|
|
|
733
736
|
let error = checkForUnpopulatedData(rounds, 'Round.getPortfolioByFunds');
|
|
734
737
|
if (error) return cb(error, null);
|
|
735
738
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
+
if (!options.isWorkerProcess) {
|
|
740
|
+
_.each(rounds, function(round) {
|
|
741
|
+
round.organization = helpers.cleanOrg(round.organization, options.CUSTOMER_ID);
|
|
742
|
+
if(round.organization.filters) console.log(round.organization.filters.toObject());
|
|
743
|
+
});
|
|
744
|
+
}
|
|
739
745
|
|
|
740
746
|
return cb(null, buildPortfolio(rounds, fundIds));
|
|
741
747
|
|