From 6073db26aaaecf33a8c14f9ab7857fb1a6ff8b5d Mon Sep 17 00:00:00 2001 From: Josephine Date: Fri, 5 Apr 2024 14:16:04 -0400 Subject: [PATCH 1/3] feat: messy wip --- .../app/routes/application.js | 8 +++++ .../app/services/studio.js | 31 ++++++++++++++-- .../templates/components/metrics-drawer.hbs | 35 +++++++++++++++++-- PROFIT_SHARE_CALCULATOR/config/environment.js | 2 +- 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/PROFIT_SHARE_CALCULATOR/app/routes/application.js b/PROFIT_SHARE_CALCULATOR/app/routes/application.js index ec7328fe..4299c1c3 100644 --- a/PROFIT_SHARE_CALCULATOR/app/routes/application.js +++ b/PROFIT_SHARE_CALCULATOR/app/routes/application.js @@ -18,7 +18,15 @@ export default Route.extend({ desiredPayrollBufferMonths: item.desired_buffer_months, income: item.gross_revenue, expenses: item.gross_expenses, + // TODO: replace placeholders (which are from 2022) + benefits: 329431.75, + subcontractors: 1151517.51, + preSpent: 26282.61, + preSpentReinvestment: 0, + // 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, diff --git a/PROFIT_SHARE_CALCULATOR/app/services/studio.js b/PROFIT_SHARE_CALCULATOR/app/services/studio.js index ae512416..80b22608 100644 --- a/PROFIT_SHARE_CALCULATOR/app/services/studio.js +++ b/PROFIT_SHARE_CALCULATOR/app/services/studio.js @@ -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({ @@ -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(), @@ -136,22 +145,40 @@ export default Service.extend( }; }).readOnly(), + // TODO: rename me to reflect more than labor laborCost: computed('technologists.@each.salary', '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() { + console.log(get(this, 'benefits')); + 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(), diff --git a/PROFIT_SHARE_CALCULATOR/app/templates/components/metrics-drawer.hbs b/PROFIT_SHARE_CALCULATOR/app/templates/components/metrics-drawer.hbs index 09e7b288..da3ebc88 100644 --- a/PROFIT_SHARE_CALCULATOR/app/templates/components/metrics-drawer.hbs +++ b/PROFIT_SHARE_CALCULATOR/app/templates/components/metrics-drawer.hbs @@ -50,7 +50,37 @@ Total PSU Issued (Computed) {{input value=studio.totalPSUIssued disabled=true}} -{{else}} +{{/if}} +{{#if (eq studio.mode studio.Modes.REAL)}} + + + + +{{/if}} -{{/if}} diff --git a/PROFIT_SHARE_CALCULATOR/config/environment.js b/PROFIT_SHARE_CALCULATOR/config/environment.js index 85a0a428..a936d77a 100644 --- a/PROFIT_SHARE_CALCULATOR/config/environment.js +++ b/PROFIT_SHARE_CALCULATOR/config/environment.js @@ -32,7 +32,7 @@ module.exports = function(environment) { // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; - ENV.stacksOrigin = 'http://localhost:3000/api/profit_share_passes'; + // ENV.stacksOrigin = 'http://localhost:3000/api/profit_share_passes'; } if (environment === 'test') { From 56ecdf3f1fcc7c835d311945a584dae147b623a1 Mon Sep 17 00:00:00 2001 From: Josephine Date: Fri, 5 Apr 2024 17:38:42 -0400 Subject: [PATCH 2/3] feat: replace hardcoded 2022 data with real data --- PROFIT_SHARE_CALCULATOR/app/routes/application.js | 10 ++++------ PROFIT_SHARE_CALCULATOR/app/services/studio.js | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/PROFIT_SHARE_CALCULATOR/app/routes/application.js b/PROFIT_SHARE_CALCULATOR/app/routes/application.js index 4299c1c3..a8349eb3 100644 --- a/PROFIT_SHARE_CALCULATOR/app/routes/application.js +++ b/PROFIT_SHARE_CALCULATOR/app/routes/application.js @@ -18,12 +18,10 @@ export default Route.extend({ desiredPayrollBufferMonths: item.desired_buffer_months, income: item.gross_revenue, expenses: item.gross_expenses, - // TODO: replace placeholders (which are from 2022) - benefits: 329431.75, - subcontractors: 1151517.51, - preSpent: 26282.61, - preSpentReinvestment: 0, - // + 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 diff --git a/PROFIT_SHARE_CALCULATOR/app/services/studio.js b/PROFIT_SHARE_CALCULATOR/app/services/studio.js index 80b22608..d6ff57e8 100644 --- a/PROFIT_SHARE_CALCULATOR/app/services/studio.js +++ b/PROFIT_SHARE_CALCULATOR/app/services/studio.js @@ -168,7 +168,6 @@ export default Service.extend( // end /* Total cost of doing business */ totalCostOfDoingBusiness: computed('actuallaborCost', 'expenses', 'benefits', 'subcontractors', 'preSpent', 'preSpentReinvestment', function() { - console.log(get(this, 'benefits')); return get(this, 'actualLaborCost') + get(this, 'expenses') + get(this, 'benefits') + get(this, 'subcontractors') - get(this, 'preSpent') - get(this, 'preSpentReinvestment'); }).readOnly(), From 8866259a87e27c374eed8384718676be4f598f48 Mon Sep 17 00:00:00 2001 From: Josephine Date: Fri, 5 Apr 2024 17:39:55 -0400 Subject: [PATCH 3/3] revert: env change --- PROFIT_SHARE_CALCULATOR/config/environment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PROFIT_SHARE_CALCULATOR/config/environment.js b/PROFIT_SHARE_CALCULATOR/config/environment.js index a936d77a..85a0a428 100644 --- a/PROFIT_SHARE_CALCULATOR/config/environment.js +++ b/PROFIT_SHARE_CALCULATOR/config/environment.js @@ -32,7 +32,7 @@ module.exports = function(environment) { // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; - // ENV.stacksOrigin = 'http://localhost:3000/api/profit_share_passes'; + ENV.stacksOrigin = 'http://localhost:3000/api/profit_share_passes'; } if (environment === 'test') {