@dhyasama/totem-models 7.4.1 → 7.5.1

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,33 +875,25 @@ 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
-
880
- if (!vehicle.investments || vehicle.investments.length == 0) return;
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
- }
878
+
879
+ doc.vehicles = _.filter(doc.vehicles, function(vehicle) {
880
+ return vehicle.investments.length > 0;
881
+ });
892
882
 
893
- doc.vehicles = _.filter(doc.vehicles, function(v) {
894
- return v.investments.length >= 1;
895
- });
883
+ var allInvestments = _.flatten(_.pluck(doc.vehicles, 'investments'));
884
+ var mostRecentInvestment = _.max(allInvestments, function(investment) { return investment.investmentDate; });
896
885
 
897
- });
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
+ }
898
892
 
899
893
  return next();
900
894
 
901
895
  });
902
896
 
903
-
904
-
905
897
  ///////////////////////////////////////////////////////////////////////////////////////
906
898
  // CONFIG
907
899
  ///////////////////////////////////////////////////////////////////////////////////////
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.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",