Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.

Commit 913d9d1

Browse files
Shpigfordclaude
andauthored
Set reasonable default values for all financial calculators (#341)
Updated all 11 financial calculator presenters with sensible defaults to improve user experience: - Bogleheads Growth Calculator: $10,000 initial investment - Early Mortgage Payoff Calculator: 6.5% interest rate - Financial Freedom Calculator: $50,000 savings, $4,000 monthly expenses, 7% growth rate - Home Affordability Calculator: $400,000 home price, $80,000 down payment, $100,000 income, 6.5% rate, 30-year loan - Inflation Calculator: $1,000 initial amount, 10 years - Loan Calculator: $25,000 loan amount, 5.5% interest rate, 5-year term - Retirement Calculator: Age 30, $75,000 salary, $25,000 current balance, 6% contribution, 3% salary increase, 50% employer match on 6% - ROI Calculator: $10,000 invested, $12,500 returned, 3 years - Stock Portfolio Backtest: SPY benchmark, 1 year lookback, AAPL/MSFT/GOOGL portfolio with equal allocation - Compound Interest Calculator: $5,000 initial, $500 monthly contribution, 7% annual rate, 20 years These defaults allow users to quickly try out each calculator without having to fill in all fields from zero, providing a better first-time user experience. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5e6966d commit 913d9d1

12 files changed

Lines changed: 37 additions & 37 deletions

app/controllers/terms_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def index
2727
# GET /terms/ruby-on-rails
2828
def show
2929
@term = Term.find_by(slug: params[:id])
30-
30+
3131
if @term.nil?
3232
redirect_to terms_path, alert: "The financial term you're looking for could not be found."
3333
end

app/models/article.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def to_param
2828
end
2929

3030
def self.ransackable_attributes(auth_object = nil)
31-
["author_name", "content", "created_at", "id", "meta_image_url", "publish_at", "slug", "title", "updated_at"]
31+
[ "author_name", "content", "created_at", "id", "meta_image_url", "publish_at", "slug", "title", "updated_at" ]
3232
end
3333

3434
private

app/presenters/tool/presenter/bogleheads_growth_calculator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Tool::Presenter::BogleheadsGrowthCalculator < Tool::Presenter
2-
attribute :invested_amount, :tool_float, default: 0.0
2+
attribute :invested_amount, :tool_float, default: 10000.0
33

44
attribute :stock_market_percentage, :tool_percentage, default: 40.0
55
attribute :international_stock_market_percentage, :tool_percentage, default: 30.0

app/presenters/tool/presenter/compound_interest_calculator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
class Tool::Presenter::CompoundInterestCalculator < Tool::Presenter
2-
attribute :annual_interest_rate, :tool_percentage, default: 0.0
2+
attribute :annual_interest_rate, :tool_percentage, default: 7.0
33

4-
attribute :initial_investment, :tool_float, default: 0.0
5-
attribute :monthly_contribution, :tool_float, default: 0.0
6-
attribute :years_to_grow, :tool_float, default: 0.0, min: 0.0, max: 150.0
4+
attribute :initial_investment, :tool_float, default: 5000.0
5+
attribute :monthly_contribution, :tool_float, default: 500.0
6+
attribute :years_to_grow, :tool_float, default: 20.0, min: 0.0, max: 150.0
77
attribute :filter, :string
88

99
def blank?

app/presenters/tool/presenter/early_mortgage_payoff_calculator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Tool::Presenter::EarlyMortgagePayoffCalculator < Tool::Presenter
22
attribute :loan_amount, :tool_float, default: 500_000, min: 0.0, max: 1_000_000.0
33
attribute :extra_payment, :tool_float, default: 500.0
44

5-
attribute :interest_rate, :tool_percentage, default: 0.0
5+
attribute :interest_rate, :tool_percentage, default: 6.5
66
attribute :savings_rate, :tool_percentage, default: 4.0
77

88
attribute :original_term, :tool_integer, default: 30

app/presenters/tool/presenter/financial_freedom_calculator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Tool::Presenter::FinancialFreedomCalculator < Tool::Presenter
2-
attribute :annual_savings_growth_rate, :tool_percentage, default: 0.0
2+
attribute :annual_savings_growth_rate, :tool_percentage, default: 7.0
33

4-
attribute :current_savings, :tool_float, default: 0.0
5-
attribute :monthly_expenses, :tool_float, default: 0.0
4+
attribute :current_savings, :tool_float, default: 50000.0
5+
attribute :monthly_expenses, :tool_float, default: 4000.0
66

77
def blank?
88
[ current_savings, monthly_expenses, annual_savings_growth_rate ].all?(&:zero?)

app/presenters/tool/presenter/home_affordability_calculator.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
class Tool::Presenter::HomeAffordabilityCalculator < Tool::Presenter
2-
attribute :loan_duration, :tool_integer, default: 0.0
2+
attribute :loan_duration, :tool_integer, default: 30
33

4-
attribute :loan_interest_rate, :tool_percentage, default: 0.0
4+
attribute :loan_interest_rate, :tool_percentage, default: 6.5
55

6-
attribute :desired_home_price, :tool_float, default: 0.0
7-
attribute :down_payment, :tool_float, default: 0.0
8-
attribute :annual_pre_tax_income, :tool_float, default: 0.0
9-
attribute :monthly_debt_payments, :tool_float, default: 0.0
10-
attribute :hoa_plus_pmi, :tool_float, default: 0.0
6+
attribute :desired_home_price, :tool_float, default: 400000.0
7+
attribute :down_payment, :tool_float, default: 80000.0
8+
attribute :annual_pre_tax_income, :tool_float, default: 100000.0
9+
attribute :monthly_debt_payments, :tool_float, default: 500.0
10+
attribute :hoa_plus_pmi, :tool_float, default: 300.0
1111

1212
def blank?
1313
[ desired_home_price, down_payment, annual_pre_tax_income, loan_interest_rate, monthly_debt_payments ].all?(&:zero?)

app/presenters/tool/presenter/inflation_calculator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Tool::Presenter::InflationCalculator < Tool::Presenter
22
attribute :inflation_percentage, :tool_percentage, default: 3.0
33

4-
attribute :initial_amount, :tool_float, default: 0.0
5-
attribute :years, :tool_float, default: 0.0
4+
attribute :initial_amount, :tool_float, default: 1000.0
5+
attribute :years, :tool_float, default: 10.0
66

77
def blank?
88
[ initial_amount, years ].all?(&:zero?)

app/presenters/tool/presenter/loan_calculator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Tool::Presenter::LoanCalculator < Tool::Presenter
2-
attribute :loan_amount, :tool_float, default: 0.0
3-
attribute :interest_rate, :tool_percentage, default: 0.0
4-
attribute :loan_term, :tool_integer, default: 0
2+
attribute :loan_amount, :tool_float, default: 25000.0
3+
attribute :interest_rate, :tool_percentage, default: 5.5
4+
attribute :loan_term, :tool_integer, default: 5
55
attribute :loan_period, :tool_enum, enum: %w[ years months ], default: "years"
66
attribute :date, :date, default: -> { Date.today }
77

app/presenters/tool/presenter/retirement_calculator.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
class Tool::Presenter::RetirementCalculator < Tool::Presenter
22
attribute :retirement_age, :tool_integer, default: 65, max: 100
3-
attribute :current_age, :tool_integer, default: 0, min: 0
3+
attribute :current_age, :tool_integer, default: 30, min: 0
44

5-
attribute :annual_salary, :tool_float, default: 0.0
6-
attribute :current_401k_balance, :tool_float, default: 0.0
5+
attribute :annual_salary, :tool_float, default: 75000.0
6+
attribute :current_401k_balance, :tool_float, default: 25000.0
77

88
attribute :annual_rate_of_return, :tool_percentage, default: 5.0
9-
attribute :monthly_contribution, :tool_percentage, default: 0.0
10-
attribute :annual_salary_increase, :tool_percentage, default: 0.0
11-
attribute :employer_match, :tool_percentage, default: 0.0
12-
attribute :salary_limit_match, :tool_percentage, default: 0.0
9+
attribute :monthly_contribution, :tool_percentage, default: 6.0
10+
attribute :annual_salary_increase, :tool_percentage, default: 3.0
11+
attribute :employer_match, :tool_percentage, default: 50.0
12+
attribute :salary_limit_match, :tool_percentage, default: 6.0
1313

1414
def blank?
1515
[ annual_salary, monthly_contribution, annual_salary_increase,

0 commit comments

Comments
 (0)