Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated PSU logic (WIP) #92

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions PROFIT_SHARE_CALCULATOR/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ export default Route.extend({
desiredPayrollBufferMonths: item.desired_buffer_months,
income: item.gross_revenue,
expenses: item.gross_expenses,
benefits: item.gross_benefits,
subcontractors: item.subcontractors,
preSpent: item.pre_spent,
preSpentReinvestment: item.pre_spent_reinvestment,
actualLaborCost: item.gross_payroll,
// This isn't a true equivalency: projected_monthly_cost_of_doing_business takes
// more than just payroll into account
projectedLaborCost: item.projected_monthly_cost_of_doing_business,
actualTotalPSUIssued: item.total_psu_issued,
ficaPercentage: item.fica_tax_rate,
Expand Down
30 changes: 28 additions & 2 deletions PROFIT_SHARE_CALCULATOR/app/services/studio.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default Service.extend(
actualLaborCost: 0,
projectedLaborCost: 0,
actualTotalPSUIssued: 0,
benefits: 0,
subcontractors: 0,
preSpent: 0,
preSpentReinvestment: 0,

reset() {
this.setProperties({
Expand All @@ -47,8 +51,13 @@ export default Service.extend(
});
},

// def raw_efficiency
// @actuals[:gross_revenue].to_f / total_cost_of_doing_business
// end
/* Computed Properties */
rawEfficiency: computed('income', 'laborCost', 'expenses', function() {
if (get(this, 'mode') === Modes.REAL) return get(this, 'income') / (get(this, 'totalCostOfDoingBusiness'));

return get(this, 'income') / (get(this, 'laborCost') + get(this, 'expenses'));
}).readOnly(),

Expand Down Expand Up @@ -136,22 +145,39 @@ export default Service.extend(
};
}).readOnly(),

// TODO: rename me to reflect more than labor
laborCost: computed('[email protected]', 'mode', 'actualLaborCost', function() {
/* The Labor Cost attribute is concerned with determining the years
* effeciency, so in Modes.REAL we use the "actuaLaborCost" for that
* efficiency, so in Modes.REAL we use the "actualLaborCost" for that
* year, rather than a computed projection, as the team may have changed
* substantially that year.
*/
if (get(this, 'mode') === Modes.REAL) return get(this, 'actualLaborCost');
if (get(this, 'mode') === Modes.REAL) return get(this, 'totalCostOfDoingBusiness');

/* Modes.MOCK doesn't take anything other than payroll into account for cost*/
return get(this, 'technologists').reduce((a, tech) => a + get(tech, 'laborCostThisYear'), 0);
}).readOnly(),

// def total_cost_of_doing_business
// @actuals[:gross_payroll].to_f +
// @actuals[:gross_expenses].to_f +
// @actuals[:gross_benefits].to_f +
// @actuals[:gross_subcontractors].to_f -
// @pre_spent - # Don't count prespent profit share against this
// @pre_spent_reinvestment # Don't count prespent reinvestment against this
// end
/* Total cost of doing business */
totalCostOfDoingBusiness: computed('actuallaborCost', 'expenses', 'benefits', 'subcontractors', 'preSpent', 'preSpentReinvestment', function() {
return get(this, 'actualLaborCost') + get(this, 'expenses') + get(this, 'benefits') + get(this, 'subcontractors') - get(this, 'preSpent') - get(this, 'preSpentReinvestment');
}).readOnly(),

monthlyLaborCost: computed('laborCost', 'mode', 'projectedLaborCost', function() {
/* Monthly Labor Cost is concerned with Generating Payroll buffer,
* so in Modes.REAL we use the most "up to date" projection for
* salary costing, rather than actualLaborCost.
*/
// This is really projected_monthly_cost_of_doing_business in Stacks, which takes
// more than labor into account
if (get(this, 'mode') === Modes.REAL) return (get(this, 'projectedLaborCost') / 12);
return get(this, 'laborCost') / 12;
}).readOnly(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,37 @@
Total PSU Issued (Computed)
{{input value=studio.totalPSUIssued disabled=true}}
</label>
{{else}}
{{/if}}
{{#if (eq studio.mode studio.Modes.REAL)}}
<label class='metric-input left-aligned block pb2'>
Benefits
<input
value={{studio.benefits}}
oninput={{action 'setNumeric' 'benefits'}}
>
</label>
<label class='metric-input left-aligned block pb2'>
Subcontractors
<input
value={{studio.subcontractors}}
oninput={{action 'setNumeric' 'subcontractors'}}
>
</label>
<label class='metric-input left-aligned block pb2'>
Pre-spent profit share
<input
value={{studio.preSpent}}
oninput={{action 'setNumeric' 'pre_spent'}}
>
</label>
<label class='metric-input left-aligned block pb2'>
Pre-spent reinvestment budget
<input
value={{studio.preSpentReinvestment}}
oninput={{action 'setNumeric' 'pre_spent_reinvestment'}}
>
</label>
{{/if}}
<label class='metric-input left-aligned block pb2'>
Actualized Labor Cost
<input
Expand All @@ -59,7 +89,7 @@
>
</label>
<label class='metric-input left-aligned block pb2'>
Projected Labor Cost
Projected Monthly Cost of Doing Business
<input
value={{studio.projectedLaborCost}}
oninput={{action 'setNumeric' 'projectedLaborCost'}}
Expand All @@ -72,4 +102,3 @@
oninput={{action 'setNumeric' 'actualTotalPSUIssued'}}
>
</label>
{{/if}}