Skip to content

Commit

Permalink
Add EarlyYearsPayment scaffolding
Browse files Browse the repository at this point in the history
- Add models (journey, eligibility, session, session_answers, slug_sequence, policy) for
 the new EarlyYearsPayment journey.
- Add basic happy path spec that visits the landing page.
- Add basic view for landing page
- Include the new journey config in the seeds
- Add migration to create early_years_payment_eligibilities.
  • Loading branch information
AbigailMcP committed Jul 24, 2024
1 parent c423f29 commit db39d8f
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 10 deletions.
3 changes: 2 additions & 1 deletion app/models/journeys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def self.table_name_prefix
AdditionalPaymentsForTeaching,
TeacherStudentLoanReimbursement,
GetATeacherRelocationPayment,
FurtherEducationPayments
FurtherEducationPayments,
EarlyYearsPayment
].freeze

def all
Expand Down
14 changes: 14 additions & 0 deletions app/models/journeys/early_years_payment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Journeys
module EarlyYearsPayment
extend Base
extend self

ROUTING_NAME = "early-years-payment"
VIEW_PATH = "early_years_payment"
I18N_NAMESPACE = "early_years_payment"
POLICIES = [Policies::EarlyYearsPayment]
FORMS = {
"claims" => {}
}
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Journeys
module EarlyYearsPayment
class EligibilityChecker < Journeys::EligibilityChecker
end
end
end
7 changes: 7 additions & 0 deletions app/models/journeys/early_years_payment/session.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Journeys
module EarlyYearsPayment
class Session < Journeys::Session
attribute :answers, SessionAnswersType.new
end
end
end
9 changes: 9 additions & 0 deletions app/models/journeys/early_years_payment/session_answers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Journeys
module EarlyYearsPayment
class SessionAnswers < Journeys::SessionAnswers
def policy
Policies::EarlyYearsPayment
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Journeys
module EarlyYearsPayment
class SessionAnswersType < ::Journeys::SessionAnswersType; end
end
end
40 changes: 40 additions & 0 deletions app/models/journeys/early_years_payment/slug_sequence.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module Journeys
module EarlyYearsPayment
class SlugSequence
ELIGIBILITY_SLUGS = %w[].freeze

PERSONAL_DETAILS_SLUGS = %w[].freeze

PAYMENT_DETAILS_SLUGS = %w[].freeze

RESULTS_SLUGS = %w[].freeze

SLUGS = (
ELIGIBILITY_SLUGS +
PERSONAL_DETAILS_SLUGS +
PAYMENT_DETAILS_SLUGS +
RESULTS_SLUGS
).freeze

def self.start_page_url
if Rails.env.production?
"https://www.example.com" # TODO: update to correct guidance
else
Rails.application.routes.url_helpers.landing_page_path("early-years-payment")
end
end

attr_reader :journey_session

delegate :answers, to: :journey_session

def initialize(journey_session)
@journey_session = journey_session
end

def slugs
SLUGS
end
end
end
end
14 changes: 14 additions & 0 deletions app/models/policies/early_years_payment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Policies
module EarlyYearsPayment
include BasePolicy
extend self

# Percentage of claims to QA
MIN_QA_THRESHOLD = 10

# TODO: This is needed once the reply-to email address has been added to Gov Notify
def notify_reply_to_id
nil
end
end
end
17 changes: 17 additions & 0 deletions app/models/policies/early_years_payment/eligibility.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Policies
module EarlyYearsPayment
class Eligibility < ApplicationRecord
self.table_name = "early_years_payment_eligibilities"

has_one :claim, as: :eligibility, inverse_of: :eligibility

def policy
Policies::EarlyYearsPayment
end

def ineligible?
false
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Policies
module EarlyYearsPayment
class PolicyEligibilityChecker
attr_reader :answers

delegate_missing_to :answers

def initialize(answers:)
@answers = answers
end

def status
return :ineligible if ineligible?

:eligible_now
end

def ineligible?
false
end
end
end
end
5 changes: 5 additions & 0 deletions app/views/early_years_payment/landing_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= govuk_start_button(text: "Start now", href: "#") %>
</div>
</div>
4 changes: 4 additions & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,7 @@ shared:
- lower_award_amount
- created_at
- updated_at
:early_years_payment_eligibilities:
- id
- created_at
- updated_at
27 changes: 21 additions & 6 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -978,35 +978,50 @@ en:
questions:
performance:
question: Have any performance measures been started against you?
hint: This will be as a result of your underperformance as a teacher over a period of time. It could put your employment at the further education (FE) provider at risk and is something we may check with them as it will affect your eligibility.
hint:
This will be as a result of your underperformance as a teacher over a period of time. It could put your
employment at the further education (FE) provider at risk and is something we may check with them as it
will affect your eligibility.
disciplinary:
question: Are you currently subject to disciplinary action?
hint: This is more serious than performance measures and could be because of misconduct. It is something we may check with your FE provider as it will affect your eligibility.
hint:
This is more serious than performance measures and could be because of misconduct. It is something we may
check with your FE provider as it will affect your eligibility.
errors:
performance:
inclusion: Select yes if you are subject to formal action for poor performance at work
disciplinary:
inclusion: Select yes if you are subject to disciplinary action
half_teaching_hours:
question: Are at least half of your timetabled teaching hours spent teaching 16 to 19-year-olds, including those up to age 25 with an Education, Health and Care Plan (EHCP)?
question:
Are at least half of your timetabled teaching hours spent teaching 16 to 19-year-olds, including those up to
age 25 with an Education, Health and Care Plan (EHCP)?
errors:
inclusion: Select yes if at least half your timetabled teaching hours are spent teaching 16-19-year-olds, including those up to 25 with an Education, Health and Care Plan
inclusion:
Select yes if at least half your timetabled teaching hours are spent teaching 16-19-year-olds, including
those up to 25 with an Education, Health and Care Plan
eligible:
heading: You’re eligible for a financial incentive payment
gender:
questions:
payroll_gender: "How is your gender recorded on your employer’s payroll system?"
errors:
select_gender: "Select the gender recorded on your employer’s payroll system or select whether you do not know"
select_gender:
"Select the gender recorded on your employer’s payroll system or select whether you do not know"
check_your_answers:
part_one:
primary_heading: Check your answers
confirmation_notice: By selecting continue you are confirming that, to the best of your knowledge, the details you are providing are correct.
confirmation_notice:
By selecting continue you are confirming that, to the best of your knowledge, the details you are providing
are correct.
heading_send_application: Now send your application
statement:
By submitting this you are confirming that, to the best of your knowledge, the details you are providing are
correct.
btn_text: Accept and send
early_years_payment:
journey_name: Claim an early years financial incentive payment
feedback_email: "TODO EMAIL GOES HERE"
activerecord:
errors:
models:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CreateEarlyYearsPaymentEligibilities < ActiveRecord::Migration[7.0]
def change
create_table :early_years_payment_eligibilities, id: :uuid do |t|
t.timestamps
end
end
end
7 changes: 6 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_07_10_080536) do
ActiveRecord::Schema[7.0].define(version: 2024_07_24_092519) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"
Expand Down Expand Up @@ -175,6 +175,11 @@
t.index ["teacher_reference_number"], name: "index_ecp_eligibility_trn"
end

create_table "early_years_payment_eligibilities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "eligible_fe_providers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.integer "ukprn", null: false
t.text "academic_year", null: false
Expand Down
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Journeys::Configuration.create!(routing_name: Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME, current_academic_year: AcademicYear.current)
Journeys::Configuration.create!(routing_name: Journeys::GetATeacherRelocationPayment::ROUTING_NAME, current_academic_year: AcademicYear.current)
Journeys::Configuration.create!(routing_name: Journeys::FurtherEducationPayments::ROUTING_NAME, current_academic_year: AcademicYear.current)
Journeys::Configuration.create!(routing_name: Journeys::EarlyYearsPayment::ROUTING_NAME, current_academic_year: AcademicYear.current)

ENV["FIXTURES_PATH"] = "spec/fixtures"
ENV["FIXTURES"] = "local_authorities,local_authority_districts,schools"
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/journey_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
routing_name { Journeys::FurtherEducationPayments::ROUTING_NAME }
end

trait :early_years_payment do
routing_name { Journeys::EarlyYearsPayment::ROUTING_NAME }
end

trait :closed do
open_for_submissions { false }
end
Expand Down
10 changes: 10 additions & 0 deletions spec/features/early_years_payment/happy_path_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "rails_helper"

RSpec.feature "Early years payment" do
scenario "happy path claim" do
when_early_years_payment_journey_configuration_exists

visit landing_page_path(Journeys::EarlyYearsPayment::ROUTING_NAME)
expect(page).to have_link("Start now")
end
end
6 changes: 4 additions & 2 deletions spec/models/journeys_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
Journeys::AdditionalPaymentsForTeaching,
Journeys::TeacherStudentLoanReimbursement,
Journeys::GetATeacherRelocationPayment,
Journeys::FurtherEducationPayments
Journeys::FurtherEducationPayments,
Journeys::EarlyYearsPayment
])
end
end
Expand All @@ -20,7 +21,8 @@
Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME,
Journeys::TeacherStudentLoanReimbursement::ROUTING_NAME,
Journeys::GetATeacherRelocationPayment::ROUTING_NAME,
Journeys::FurtherEducationPayments::ROUTING_NAME
Journeys::FurtherEducationPayments::ROUTING_NAME,
Journeys::EarlyYearsPayment::ROUTING_NAME
])
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/support/steps/journey_configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
def when_further_education_payments_journey_configuration_exists
create(:journey_configuration, :further_education_payments)
end

def when_early_years_payment_journey_configuration_exists
create(:journey_configuration, :early_years_payment)
end

0 comments on commit db39d8f

Please sign in to comment.