Created
August 8, 2013 21:43
-
-
Save adamrneary/6189053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculate: (periodId) => | |
r = | |
periodUnix: app.periods.idToUnix(periodId) | |
beginningCash: @get(app.periods.prevId(periodId))?.endingCash | |
if app.periods.notPast(periodId) | |
s = app.scenario.toJSON() | |
keys = ['revenue', 'cogs', 'custAcq', 'team', 'vendor'] | |
_.each keys, (key) => | |
days = if key is 'custAcq' then s.cust_acq_days else s["#{key}_days"] | |
val = @_periodCash periodId, (days ? 0), "#{key}Plan" | |
multiplier = if key is 'custAcq' | |
s.cust_acq_multiplier | |
else s["#{key}_multiplier"] | |
val *= (1 + (multiplier ? 0)/100) | |
r["#{key}Plan"] = val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment