@dhyasama/totem-models 7.5.0 → 7.6.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 +6 -18
- package/lib/Organization.js +8 -2
- package/lib/Round.js +4 -2
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -90,24 +90,8 @@ module.exports = function(mongoose, config) {
|
|
|
90
90
|
}]
|
|
91
91
|
},
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
value: { type: Number },
|
|
96
|
-
_id: false
|
|
97
|
-
}],
|
|
98
|
-
|
|
99
|
-
questions: [{
|
|
100
|
-
key: { type: String, trim: true },
|
|
101
|
-
value: { type: String, trim: true },
|
|
102
|
-
_id: false
|
|
103
|
-
}],
|
|
104
|
-
|
|
105
|
-
// Catch-all for customer specific key-value pairs from sheet that aren't supported by our schema
|
|
106
|
-
details: [{
|
|
107
|
-
key: { type: String, trim: true },
|
|
108
|
-
value: { type: String, trim: true },
|
|
109
|
-
_id: false
|
|
110
|
-
}],
|
|
93
|
+
kpis: { type: Schema.Types.Mixed },
|
|
94
|
+
questions: { type: Schema.Types.Mixed },
|
|
111
95
|
|
|
112
96
|
comment: { type: String, trim: true },
|
|
113
97
|
documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
|
|
@@ -360,6 +344,10 @@ module.exports = function(mongoose, config) {
|
|
|
360
344
|
|
|
361
345
|
if (!financials) { return cb(new Error('financials is required'), null); }
|
|
362
346
|
|
|
347
|
+
// Required for mixed types
|
|
348
|
+
financials.markModified('kpis');
|
|
349
|
+
financials.markModified('questions');
|
|
350
|
+
|
|
363
351
|
financials.save(cb);
|
|
364
352
|
|
|
365
353
|
};
|
package/lib/Organization.js
CHANGED
|
@@ -215,8 +215,14 @@ module.exports = function(mongoose, config) {
|
|
|
215
215
|
|
|
216
216
|
financials : {
|
|
217
217
|
active: { type: Boolean, default: false },
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
kpis: [{
|
|
219
|
+
name: { type: String, trim: true },
|
|
220
|
+
description: { type: String, trim: true },
|
|
221
|
+
format: { type: String, trim: true },
|
|
222
|
+
}],
|
|
223
|
+
questions: [{
|
|
224
|
+
prompt: { type: String, enum: [null, 'number', 'money', 'percentage', 'variance']},
|
|
225
|
+
}],
|
|
220
226
|
},
|
|
221
227
|
|
|
222
228
|
irr: {
|
package/lib/Round.js
CHANGED
|
@@ -875,6 +875,10 @@ module.exports = function(mongoose, config) {
|
|
|
875
875
|
|
|
876
876
|
// participating vehicles are public
|
|
877
877
|
// merge private data that was matched for customer
|
|
878
|
+
|
|
879
|
+
doc.vehicles = _.filter(doc.vehicles, function(vehicle) {
|
|
880
|
+
return vehicle.investments.length > 0;
|
|
881
|
+
});
|
|
878
882
|
|
|
879
883
|
var allInvestments = _.flatten(_.pluck(doc.vehicles, 'investments'));
|
|
880
884
|
var mostRecentInvestment = _.max(allInvestments, function(investment) { return investment.investmentDate; });
|
|
@@ -890,8 +894,6 @@ module.exports = function(mongoose, config) {
|
|
|
890
894
|
|
|
891
895
|
});
|
|
892
896
|
|
|
893
|
-
|
|
894
|
-
|
|
895
897
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
896
898
|
// CONFIG
|
|
897
899
|
///////////////////////////////////////////////////////////////////////////////////////
|