@dhyasama/totem-models 7.2.4 → 7.4.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/CapTable.js CHANGED
@@ -254,6 +254,18 @@ module.exports = function(mongoose, config) {
254
254
 
255
255
  };
256
256
 
257
+ CapTable.statics.getAllForCustomer2 = function getAllForCustomer2(customerId, cb) {
258
+
259
+ var self = this;
260
+
261
+ self
262
+ .find({customer: customerId })
263
+ .populate('stakeholders.person', 'name avatarUrl title')
264
+ .populate('stakeholders.fund', 'name shortName')
265
+ .exec(cb);
266
+
267
+ };
268
+
257
269
  CapTable.statics.getByFunds = function getByFunds(fundIds, cb) {
258
270
 
259
271
  var self = this;
package/lib/Financials.js CHANGED
@@ -14,11 +14,6 @@ module.exports = function(mongoose, config) {
14
14
  var _ = require('underscore');
15
15
  var moment = require('moment');
16
16
 
17
- // scheduled
18
- // not scheduled (skipped)
19
- // submitted
20
-
21
-
22
17
  var Financials = new Schema({
23
18
 
24
19
  organization: { type: Schema.ObjectId, ref: 'Organization', required: true, index: true },
@@ -37,6 +32,8 @@ module.exports = function(mongoose, config) {
37
32
 
38
33
  status: { type: String },
39
34
 
35
+ action: { type: String },
36
+
40
37
  year: { type: Number, default: 0 },
41
38
  period: { type: String, enum: ['Annual', 'Q1', 'Q2', 'Q3', 'Q4', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] },
42
39
 
@@ -383,20 +380,38 @@ module.exports = function(mongoose, config) {
383
380
 
384
381
  if(!snapshot) return;
385
382
 
386
- else if(!snapshot.uuid || snapshot.submittedOn) snapshot.status = 'Completed';
383
+ else if(!snapshot.uuid || snapshot.submittedOn) {
384
+ snapshot.status = 'Completed';
385
+ snapshot.action = null;
386
+ }
387
387
 
388
388
  else if(snapshot.notifications.company.initial.sendOn) {
389
389
 
390
390
  var isScheduled = moment().isBefore(moment(snapshot.notifications.company.initial.sendOn));
391
391
  var isOverdue = moment().subtract(30, 'd').isAfter(moment(snapshot.notifications.company.reminder.sendOn || snapshot.notifications.company.initial.sendOn));
392
+
393
+ if(isScheduled) {
394
+ snapshot.status = 'Scheduled';
395
+ snapshot.action = null;
396
+ }
397
+
398
+ else if(isOverdue) {
399
+ snapshot.status = 'Overdue';
400
+ snapshot.action = null;
401
+ }
392
402
 
393
- if(isScheduled) snapshot.status = 'Scheduled';
394
- else if(isOverdue) snapshot.status = 'Overdue';
395
- else snapshot.status = 'In Progress';
403
+ else {
404
+ snapshot.status = 'In Progress';
405
+ if(snapshot.notifications.company.reminder.status) snapshot.action = 'Reminder ' + snapshot.notifications.company.reminder.status;
406
+ else if (snapshot.notifications.company.initial.status) snapshot.action = 'Initial ' + snapshot.notifications.company.initial.status;
407
+ }
396
408
 
397
409
  }
398
410
 
399
- else snapshot.status = 'Not Scheduled';
411
+ else {
412
+ snapshot.status = 'Not Scheduled';
413
+ snapshot.action = null;
414
+ }
400
415
 
401
416
  });
402
417
 
@@ -414,8 +429,6 @@ module.exports = function(mongoose, config) {
414
429
  // todo
415
430
  });
416
431
 
417
-
418
-
419
432
  ///////////////////////////////////////////////////////////////////////////////////////
420
433
  // CONFIG
421
434
  ///////////////////////////////////////////////////////////////////////////////////////
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.2.4",
3
+ "version": "7.4.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",