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

Convert calculate-your-holiday-entitlement to use ERB templates for questions #2128

Merged
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
2 changes: 2 additions & 0 deletions lib/smart_answer_flows/calculate-your-holiday-entitlement.rb
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ def define
status :published
satisfies_need "100143"

use_erb_templates_for_questions

# Q1
multiple_choice :basis_of_calculation? do
option "days-worked-per-week"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% content_for :title do %>
How many hours will be worked a year?
<% end %>

<% content_for :hint do %>
This is calculated by excluding statutory entitlement. This calculation isn't suitable for term-time workers.
<% end %>

<% content_for :label do %>
Hours per year
<% end %>

<% content_for :error_message do %>
You need to enter a number greater than 0. Don't enter fractions. If you work half-hours, enter .5 for half. eg 340.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<% content_for :title do %>
Is the holiday entitlement based on:
<% end %>

<% options(
"days-worked-per-week": "days worked per week",
"hours-worked-per-week": "hours worked per week",
"casual-or-irregular-hours": "casual or irregular hours",
"annualised-hours": "annualised hours",
"compressed-hours": "compressed hours",
"shift-worker": "shifts"
) %>

<% content_for :hint do %>
Check the employment contract if you’re not sure about the holiday entitlement.
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% content_for :title do %>
Do you want to work out holiday:
<% end %>

<% options(
"full-year": "for a full leave year",
"starting": "for someone starting part way through a leave year",
"leaving": "for someone leaving part way through a leave year",
"starting-and-leaving": "for someone starting and leaving part way through a leave year"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% content_for :title do %>
How many hours have been worked in this leave year?
<% end %>

<% content_for :hint do %>
The holiday entitlement may be calculated as the leave builds up ('accrues') for each hour worked.
<% end %>

<% content_for :label do %>
Hours worked
<% end %>

<% content_for :error_message do %>
You need to enter a number greater than 0. Don't enter fractions. If you work half-hours, enter .5 for half. eg 340.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
Number of days per week worked?
<% end %>

<% content_for :label do %>
Days per week
<% end %>

<% content_for :error_message do %>
Please check and enter a correct value. Don't enter fractions. If you work half-days, enter .5 for half. eg 4.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
How many hours are worked per week?
<% end %>

<% content_for :label do %>
Hours per week
<% end %>

<% content_for :error_message do %>
You can enter a maximum of 168 hours per week. Don't enter fractions. If you work half-hours, enter .5 for half. eg 40.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
Number of days worked per week?
<% end %>

<% content_for :hint do %>
If you work half-days enter .5 for a half, eg 3.5 for three and a half days.
<% end %>

<% content_for :error_message do %>
Please check and enter a correct value. Don't enter fractions. If you work half-days, enter .5 for half. eg 4.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
Number of hours worked per week?
<% end %>

<% content_for :hint do %>
If you work half-hours enter .5 for a half, eg 40.5.
<% end %>

<% content_for :error_message do %>
You can enter a maximum of 168 hours per week. Don't enter fractions. If you work half-hours, enter .5 for half. eg 40.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% content_for :title do %>
Do you want to calculate the holiday:
<% end %>

<% options(
"full-year": "for a full leave year",
"starting": "for someone starting part way through a leave year",
"leaving": "for someone leaving part way through a leave year",
"starting-and-leaving": "for someone starting and leaving part way through a leave year"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% content_for :title do %>
How many days in the shift pattern?
<% end %>

<% content_for :hint do %>
The shift pattern includes non-working days.
<% end %>

<% content_for :label do %>
Days per pattern
<% end %>

<% content_for :error_message do %>
You need to enter a number greater than or equal to the number of shifts you work. Don't enter fractions. If you work half-days, enter .5 for half. eg 4.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
How many hours in each shift?
<% end %>

<% content_for :label do %>
Hours per shift
<% end %>

<% content_for :error_message do %>
You need to enter a number greater than 0. Don't enter fractions. If you work half-hours, enter .5 for half. eg 4.5
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :title do %>
How many shifts will be worked per shift pattern?
<% end %>

<% content_for :label do %>
Shifts per pattern
<% end %>

<% content_for :error_message do %>
You need to enter a number greater than 0
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% content_for :title do %>
What was the employment end date?
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% content_for :title do %>
What was the employment start date?
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% content_for :title do %>
When does the leave year start?
<% end %>

<% content_for :hint do %>
This is usually in the employment contract. If it isn’t and the job was started after 1 October 1998, the leave year will start on the 1st day of the job. If the job was started on or before 1 October 1998, the leave year will start on 1 October.
<% end %>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -37,14 +37,16 @@ <h2>
<div class="question-body">


<p class="hint">This is calculated by excluding statutory entitlement. This calculation isn&#39;t suitable for term-time workers.</p>

<p class="hint">This is calculated by excluding statutory entitlement. This calculation isn't suitable for term-time workers.</p>

<div class="">

<label for="response">Hours per year<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -37,14 +37,16 @@ <h2>
<div class="question-body">


<p class="hint">The holiday entitlement may be calculated as the leave builds up (&#39;accrues&#39;) for each hour worked.</p>

<p class="hint">The holiday entitlement may be calculated as the leave builds up ('accrues') for each hour worked.</p>

<div class="">

<label for="response">Hours worked<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,12 +38,14 @@ <h2>




<div class="">

<label for="response">Hours per week<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,12 +38,14 @@ <h2>




<div class="">

<label for="response">Days per week<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ <h2>




<div class="">

<ul class="options">
@@ -69,6 +70,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ <h2>
<div class="question-body">



<p class="hint">If you work half-days enter .5 for a half, eg 3.5 for three and a half days.</p>

<div class="">
@@ -45,6 +46,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ <h2>




<div class="">

<fieldset>
@@ -109,6 +110,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ <h2>




<div class="">

<fieldset>
@@ -109,6 +110,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ <h2>
<div class="question-body">



<p class="hint">This is usually in the employment contract. If it isn’t and the job was started after 1 October 1998, the leave year will start on the 1st day of the job. If the job was started on or before 1 October 1998, the leave year will start on 1 October.</p>

<div class="">
@@ -110,6 +111,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ <h2>
<div class="question-body">



<p class="hint">If you work half-hours enter .5 for a half, eg 40.5.</p>

<div class="">
@@ -45,6 +46,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ <h2>




<div class="">

<ul class="options">
@@ -69,6 +70,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,12 +38,14 @@ <h2>




<div class="">

<label for="response">Hours per shift<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ <h2>
<div class="question-body">



<p class="hint">The shift pattern includes non-working days.</p>

<div class="">
@@ -45,6 +46,7 @@ <h2>




</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -38,12 +38,14 @@ <h2>




<div class="">

<label for="response">Shifts per pattern<input type="text" name="response" id="response" /></label>




</div>
</div>
</div>
5 changes: 3 additions & 2 deletions test/artefacts/calculate-your-holiday-entitlement/y.html
Original file line number Diff line number Diff line change
@@ -37,8 +37,8 @@ <h2>
<div class="question-body">


<p class="hint">Check the employment contract if you’re not sure about the holiday entitlement.
</p>

<p class="hint">Check the employment contract if you’re not sure about the holiday entitlement.</p>

<div class="">

@@ -83,6 +83,7 @@ <h2>




</div>
</div>
</div>
18 changes: 16 additions & 2 deletions test/data/calculate-your-holiday-entitlement-files.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
lib/smart_answer_flows/calculate-your-holiday-entitlement.rb: ea477752bd44c3f1cfa092a7f0d8d891
lib/smart_answer_flows/locales/en/calculate-your-holiday-entitlement.yml: 0e0af2f45c9cca757b9d5fcb6fd3cc6d
lib/smart_answer_flows/calculate-your-holiday-entitlement.rb: 0ed1c1c55b7cc0a9f89054cd2e43f3e2
test/data/calculate-your-holiday-entitlement-questions-and-responses.yml: a5d687911e6173e74f2b70af6a5ff7bd
test/data/calculate-your-holiday-entitlement-responses-and-expected-results.yml: 5ff2290223d8188d45a84cde9883acf6
lib/smart_answer_flows/calculate-your-holiday-entitlement/calculate_your_holiday_entitlement.govspeak.erb: 76f569916a2429d42e52afc658285f6a
@@ -11,4 +10,19 @@ lib/smart_answer_flows/calculate-your-holiday-entitlement/outcomes/compressed_ho
lib/smart_answer_flows/calculate-your-holiday-entitlement/outcomes/days_per_week_done.govspeak.erb: 30bd1611f5d7f82ac201081d85bbf2fc
lib/smart_answer_flows/calculate-your-holiday-entitlement/outcomes/hours_per_week_done.govspeak.erb: 49beabeab25baddb8b42b02eebaca12a
lib/smart_answer_flows/calculate-your-holiday-entitlement/outcomes/shift_worker_done.govspeak.erb: 58a7a83fc28b048485a3fce1cdda59d2
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/annualised_hours.govspeak.erb: 9512159d41686b448a7c8615f1c30129
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/basis_of_calculation.govspeak.erb: abce1b150f1249d25d80ac21ef65add7
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/calculation_period.govspeak.erb: 4e7d5d3a73d64d967ac2b2fee414a125
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/casual_or_irregular_hours.govspeak.erb: 7cc48ca9b462ab65c4316877ec93e7d2
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/compressed_hours_how_many_days_per_week.govspeak.erb: 1034869fadddea66fb01e2299cde7f70
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/compressed_hours_how_many_hours_per_week.govspeak.erb: 4699acf188a353d06ebc8870adc1b680
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/how_many_days_per_week.govspeak.erb: e0a052bea6be21ba5e97b3a865de893e
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/how_many_hours_per_week.govspeak.erb: f02849bc56b12f8a726f621d3127f393
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/shift_worker_basis.govspeak.erb: e9bc2ae3ebf1cd0c9baf24a393b6a979
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/shift_worker_days_per_shift_pattern.govspeak.erb: b836c623c1238365c81f20cfbc23ad64
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/shift_worker_hours_per_shift.govspeak.erb: 518cd38a873fa195eb1e9de5e9900929
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/shift_worker_shifts_per_shift_pattern.govspeak.erb: 95b0fcc672e23cf0c086f5defb881896
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/what_is_your_leaving_date.govspeak.erb: f5356b35f0d139db060a2092618a99d7
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/what_is_your_starting_date.govspeak.erb: d2c6ff5f114bb913455c4db4d4153f9b
lib/smart_answer_flows/calculate-your-holiday-entitlement/questions/when_does_your_leave_year_start.govspeak.erb: 91de5a5baac16d04d4d0ddc4a5002b96
lib/smart_answer/calculators/holiday_entitlement.rb: 2e642f3d02f3f4a3defa2c618c5f8289