@dhyasama/totem-models 8.49.0 → 8.51.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/Fund.js +1 -43
- package/lib/Organization.js +3 -2
- package/package.json +1 -1
package/lib/Fund.js
CHANGED
|
@@ -104,48 +104,6 @@ module.exports = function(mongoose, config) {
|
|
|
104
104
|
.exec(cb);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
Fund.statics.getPerformance = function getPerformance(id, cb) {
|
|
108
|
-
|
|
109
|
-
var getLatestVehicle = function(rounds) {
|
|
110
|
-
|
|
111
|
-
var latestVehicles = [];
|
|
112
|
-
|
|
113
|
-
_.each(rounds, function (r) {
|
|
114
|
-
latestVehicles.push(_.max(r.vehicles, function (v) {
|
|
115
|
-
return v.valuationDate;
|
|
116
|
-
}));
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
latestVehicles = _.compact(latestVehicles);
|
|
120
|
-
|
|
121
|
-
return _.max(latestVehicles, function (v) { return v.valuationDate; });
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
Round.getByFund(id, function(err, rounds) {
|
|
126
|
-
|
|
127
|
-
if (err) return cb(err, null);
|
|
128
|
-
if (!rounds || rounds.length == 0) return cb(null, []);
|
|
129
|
-
|
|
130
|
-
// filter vehicles down to this fund
|
|
131
|
-
_.each(rounds, function (r) {
|
|
132
|
-
r.vehicles = _.filter(r.vehicles, function (v) {
|
|
133
|
-
return v.fund._id.toString() == id.toString();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
var latestVehicle = getLatestVehicle(rounds);
|
|
138
|
-
|
|
139
|
-
return cb(null, {
|
|
140
|
-
cost: latestVehicle.cost,
|
|
141
|
-
fairValue: latestVehicle.fairValue,
|
|
142
|
-
multiple: latestVehicle.multiple
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
};
|
|
148
|
-
|
|
149
107
|
Fund.statics.list = function list(cb) {
|
|
150
108
|
this
|
|
151
109
|
.find()
|
|
@@ -196,4 +154,4 @@ module.exports = function(mongoose, config) {
|
|
|
196
154
|
|
|
197
155
|
mongoose.model('Fund', Fund);
|
|
198
156
|
|
|
199
|
-
};
|
|
157
|
+
};
|
package/lib/Organization.js
CHANGED
|
@@ -253,8 +253,9 @@ module.exports = function(mongoose, config) {
|
|
|
253
253
|
investmentsSheet: {
|
|
254
254
|
sheet: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
255
255
|
format: {
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
transformRounds: { type: Boolean, default: false },
|
|
257
|
+
transformUnrealized: { type: Boolean, default: false },
|
|
258
|
+
transformRealized: { type: Boolean, default: false }
|
|
258
259
|
},
|
|
259
260
|
googleSheetCreds: {
|
|
260
261
|
private_key_id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|