@dhyasama/totem-models 2.3.1 → 2.3.2
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/.npmignore +14 -0
- package/lib/Financials.js +1 -26
- package/package-lock.json +1163 -0
- package/package.json +1 -1
- package/test/Financials.js +151 -0
package/.npmignore
ADDED
package/lib/Financials.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
module.exports = function(mongoose, config) {
|
|
11
11
|
|
|
12
12
|
var Schema = mongoose.Schema;
|
|
13
|
-
var Round = mongoose.model('Round');
|
|
14
13
|
var async = require('async');
|
|
15
14
|
var _ = require('underscore');
|
|
16
15
|
|
|
@@ -93,31 +92,7 @@ module.exports = function(mongoose, config) {
|
|
|
93
92
|
'customer': config.CUSTOMER_ID
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
query.exec(
|
|
97
|
-
|
|
98
|
-
if (err) return cb(err, null);
|
|
99
|
-
if (!rounds || rounds.length == 0) return cb(null, []);
|
|
100
|
-
|
|
101
|
-
var error = checkForUnpopulatedData(rounds, 'Round.getByOrg');
|
|
102
|
-
if (error) return cb(error, null);
|
|
103
|
-
|
|
104
|
-
// reverse chronological
|
|
105
|
-
rounds = _.sortBy(rounds, function(r) {
|
|
106
|
-
|
|
107
|
-
var date = r.closingDate;
|
|
108
|
-
|
|
109
|
-
// use investment date in absence of closing date
|
|
110
|
-
if (!date && r.vehicles.length && r.vehicles[0].investments.length) {
|
|
111
|
-
date = r.vehicles[0].investments[0].investmentDate;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return date;
|
|
115
|
-
|
|
116
|
-
}).reverse();
|
|
117
|
-
|
|
118
|
-
return cb(null, rounds);
|
|
119
|
-
|
|
120
|
-
});
|
|
95
|
+
query.exec(cb);
|
|
121
96
|
|
|
122
97
|
};
|
|
123
98
|
|