Skip to content

Commit

Permalink
Merge pull request #2978 from DFE-Digital/fe-subjects-branching
Browse files Browse the repository at this point in the history
[LUPEYALPHA-551] FE subjects and courses
  • Loading branch information
asmega authored Jul 15, 2024
2 parents dde54ff + 10339c0 commit f2a845f
Show file tree
Hide file tree
Showing 38 changed files with 1,340 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module Journeys
module FurtherEducationPayments
class BuildingConstructionCoursesForm < Form
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::OutputSafetyHelper
include GovukVisuallyHiddenHelper
include GovukLinkHelper

attribute :building_construction_courses, default: []

before_validation :clean_courses

validates :building_construction_courses,
presence: {message: i18n_error_message(:inclusion)},
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)}

def course_field
:building_construction_courses
end

def checkbox_options
[
OpenStruct.new(
id: "esfa_buildingconstruction",
name: t(
"options.esfa_buildingconstruction",
link: govuk_link_to("building and construction", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=7", new_tab: true)
)
),
OpenStruct.new(
id: "tlevel_building",
name: t("options.tlevel_building")
),
OpenStruct.new(
id: "tlevel_onsiteconstruction",
name: t("options.tlevel_onsiteconstruction")
),
OpenStruct.new(
id: "tlevel_design_surveying",
name: t("options.tlevel_design_surveying")
),
OpenStruct.new(
id: "level2_3_apprenticeship",
name: t(
"options.level2_3_apprenticeship",
link: govuk_link_to("construction and the built environment occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/construction", new_tab: true)
)
),
OpenStruct.new(
id: "none",
name: t("options.none")
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(building_construction_courses:)
journey_session.save!
end

private

def clean_courses
building_construction_courses.reject!(&:blank?)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module Journeys
module FurtherEducationPayments
class ChemistryCoursesForm < Form
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::OutputSafetyHelper
include GovukVisuallyHiddenHelper
include GovukLinkHelper

attribute :chemistry_courses, default: []

before_validation :clean_courses

validates :chemistry_courses,
presence: {message: i18n_error_message(:inclusion)},
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)}

def course_field
:chemistry_courses
end

def checkbox_options
[
OpenStruct.new(
id: "alevel_chemistry",
name: t("options.alevel_chemistry")
),
OpenStruct.new(
id: "gcse_chemistry",
name: t("options.gcse_chemistry")
),
OpenStruct.new(
id: "ib_certificate_chemistry",
name: t("options.ib_certificate_chemistry")
),
OpenStruct.new(
id: "none",
name: t("options.none")
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(chemistry_courses:)
journey_session.save!
end

private

def clean_courses
chemistry_courses.reject!(&:blank?)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module Journeys
module FurtherEducationPayments
class ComputingCoursesForm < Form
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::OutputSafetyHelper
include GovukVisuallyHiddenHelper
include GovukLinkHelper

attribute :computing_courses, default: []

before_validation :clean_courses

validates :computing_courses,
presence: {message: i18n_error_message(:inclusion)},
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)}

def course_field
:computing_courses
end

def checkbox_options
[
OpenStruct.new(
id: "esfa_digitalpractitioners",
name: t(
"options.esfa_digitalpractitioners",
link: govuk_link_to("digital technology for practitioners", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=23&PageSize=10&Sort=Status", new_tab: true)
)
),
OpenStruct.new(
id: "esfa_digitalusers",
name: t(
"options.esfa_digitalusers",
link: govuk_link_to("digital technology for users", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=22&PageSize=10&Sort=Status", new_tab: true)
)
),
OpenStruct.new(
id: "digitalskills_quals",
name: t("options.digitalskills_quals")
),
OpenStruct.new(
id: "tlevel_digitalsupport",
name: t("options.tlevel_digitalsupport")
),
OpenStruct.new(
id: "tlevel_digitalbusiness",
name: t("options.tlevel_digitalbusiness")
),
OpenStruct.new(
id: "tlevel_digitalproduction",
name: t("options.tlevel_digitalproduction")
),
OpenStruct.new(
id: "ib_certificate_compsci",
name: t("options.ib_certificate_compsci")
),
OpenStruct.new(
id: "level2_3_apprenticeship",
name: t(
"options.level2_3_apprenticeship",
link: govuk_link_to("digital occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/digital", new_tab: true)
)
),
OpenStruct.new(
id: "none",
name: t("options.none")
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(computing_courses:)
journey_session.save!
end

private

def clean_courses
computing_courses.reject!(&:blank?)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
module Journeys
module FurtherEducationPayments
class EarlyYearsCoursesForm < Form
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::OutputSafetyHelper
include GovukVisuallyHiddenHelper
include GovukLinkHelper

attribute :early_years_courses, default: []

before_validation :clean_courses

validates :early_years_courses,
presence: {message: i18n_error_message(:inclusion)},
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)}

def course_field
:early_years_courses
end

def checkbox_options
[
OpenStruct.new(
id: "eylevel2",
name: t("options.eylevel2")
),
OpenStruct.new(
id: "eylevel3",
name: t("options.eylevel3")
),
OpenStruct.new(
id: "eytlevel",
name: t("options.eytlevel")
),
OpenStruct.new(
id: "coursetoeyq",
name: t(
"options.coursetoeyq",
link: govuk_link_to("early years qualification", "https://www.gov.uk/government/publications/early-years-qualifications-achieved-in-england", new_tab: true)
)
),
OpenStruct.new(
id: "none",
name: t("options.none")
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(early_years_courses:)
journey_session.save!
end

private

def clean_courses
early_years_courses.reject!(&:blank?)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module Journeys
module FurtherEducationPayments
class EngineeringManufacturingCoursesForm < Form
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::OutputSafetyHelper
include GovukVisuallyHiddenHelper
include GovukLinkHelper

attribute :engineering_manufacturing_courses, default: []

before_validation :clean_courses

validates :engineering_manufacturing_courses,
presence: {message: i18n_error_message(:inclusion)},
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)}

def course_field
:engineering_manufacturing_courses
end

def checkbox_options
[
OpenStruct.new(
id: "esfa_engineering",
name: t(
"options.esfa_engineering",
link: govuk_link_to("engineering", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=13&PageSize=10&Sort=Status", new_tab: true)
)
),
OpenStruct.new(
id: "esfa_manufacturing",
name: t(
"options.esfa_manufacturing",
link: govuk_link_to("manufacturing technologies", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=26&PageSize=10&Sort=Status", new_tab: true)
)
),
OpenStruct.new(
id: "esfa_transportation",
name: t(
"options.esfa_transportation",
link: govuk_link_to("transportation operations and maintenance", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=47&PageSize=10&Sort=Status", new_tab: true)
)
),
OpenStruct.new(
id: "tlevel_design",
name: t("options.tlevel_design")
),
OpenStruct.new(
id: "tlevel_maintenance",
name: t("options.tlevel_maintenance")
),
OpenStruct.new(
id: "tlevel_engineering",
name: t("options.tlevel_engineering")
),
OpenStruct.new(
id: "level2_3_apprenticeship",
name: t(
"options.level2_3_apprenticeship",
link: govuk_link_to("engineering and manufacturing occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/engineering-manufacturing", new_tab: true)
)
),
OpenStruct.new(
id: "none",
name: t("options.none")
)
]
end

def save
return false if invalid?

journey_session.answers.assign_attributes(engineering_manufacturing_courses:)
journey_session.save!
end

private

def clean_courses
engineering_manufacturing_courses.reject!(&:blank?)
end
end
end
end
Loading

0 comments on commit f2a845f

Please sign in to comment.