@dhyasama/totem-models 7.4.1 → 7.5.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 CHANGED
@@ -402,8 +402,8 @@ module.exports = function(mongoose, config) {
402
402
 
403
403
  else {
404
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;
405
+ if(snapshot.notifications.company.reminder.status) snapshot.action = snapshot.notifications.company.reminder.status;
406
+ else if (snapshot.notifications.company.initial.status) snapshot.action = snapshot.notifications.company.initial.status;
407
407
  }
408
408
 
409
409
  }
package/lib/Round.js CHANGED
@@ -875,26 +875,16 @@ module.exports = function(mongoose, config) {
875
875
 
876
876
  // participating vehicles are public
877
877
  // merge private data that was matched for customer
878
- _.each(doc.vehicles, function(vehicle) {
879
878
 
880
- if (!vehicle.investments || vehicle.investments.length == 0) return;
879
+ var allInvestments = _.flatten(_.pluck(doc.vehicles, 'investments'));
880
+ var mostRecentInvestment = _.max(allInvestments, function(investment) { return investment.investmentDate; });
881
881
 
882
- // there can be multiple investments in a single round from the same fund
883
- // use the most recent
884
- var mostRecentInvestment = _.max(vehicle.investments, function(investment) { return investment.investmentDate; });
885
-
886
- // if we have private data, use it rather than the public data
887
- if (mostRecentInvestment) {
888
- if (mostRecentInvestment.preMoneyValuation) doc.preMoneyValuation = mostRecentInvestment.preMoneyValuation;
889
- if (mostRecentInvestment.dollarsRaised) doc.dollarsRaised = mostRecentInvestment.dollarsRaised;
890
- if (mostRecentInvestment.closingDate) doc.closingDate = mostRecentInvestment.closingDate;
891
- }
892
-
893
- doc.vehicles = _.filter(doc.vehicles, function(v) {
894
- return v.investments.length >= 1;
895
- });
896
-
897
- });
882
+ // if we have private data, use it rather than the public data
883
+ if (mostRecentInvestment) {
884
+ if (mostRecentInvestment.preMoneyValuation) doc.preMoneyValuation = mostRecentInvestment.preMoneyValuation;
885
+ if (mostRecentInvestment.dollarsRaised) doc.dollarsRaised = mostRecentInvestment.dollarsRaised;
886
+ if (mostRecentInvestment.closingDate) doc.closingDate = mostRecentInvestment.closingDate;
887
+ }
898
888
 
899
889
  return next();
900
890
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.4.1",
3
+ "version": "7.5.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",