Skip to content

Commit

Permalink
Get living wage min age from rates file for start
Browse files Browse the repository at this point in the history
Update the start page templates to dynamically fetch the minimum age to
 be eligible for the living wage from the rates file rather than being
 hard-coded in the template, similar to how is already done for the
 "last year end text".
  • Loading branch information
mtaylorgds committed Mar 14, 2024
1 parent 380a58c commit a0f099b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/flows/am_i_getting_minimum_wage_flow/start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- you’re getting paid the National Living Wage
- your employer owes you past payments from the previous year because of underpayment

^You must be at least 23 years old to get the National Living Wage.^
^You must be at least <%= this_year_living_wage_min_age("minimum_wage") %> years old to get the National Living Wage.^

Check [National Minimum Wage and National Living Wage rates](/national-minimum-wage-rates) before <%= last_year_end_text("minimum_wage") %>.
<% end %>
2 changes: 1 addition & 1 deletion app/flows/minimum_wage_calculator_employers_flow/start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- you’re paying a worker the National Living Wage
- you owe your employee payments from the previous year because you underpaid them

^Your employee must be at least 23 years old to get the National Living Wage.^
^Your employee must be at least <%= this_year_living_wage_min_age("minimum_wage") %> years old to get the National Living Wage.^

Check [National Minimum Wage and National Living Wage rates](/national-minimum-wage-rates) before <%= last_year_end_text("minimum_wage") %>.
<% end %>
9 changes: 9 additions & 0 deletions lib/smart_answer/rate_dates_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ def last_year_end_text(rates_file)
last_year(rates_file)[:end_date].strftime("%B %Y").to_s
end

def this_year_living_wage_min_age(rates_file)
this_year(rates_file)[:living_wage_min_age]
end

def this_year(rates_file)
data = SmartAnswer::Calculators::RatesQuery.from_file(rates_file)
data.current_period
end

def last_year(rates_file)
data = SmartAnswer::Calculators::RatesQuery.from_file(rates_file)
data.previous_period
Expand Down

0 comments on commit a0f099b

Please sign in to comment.