-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5982 from ministryofjustice/ap-4503-correction-to…
…-ineligible-result Ap 4503 correction to ineligible result
- Loading branch information
Showing
10 changed files
with
893 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module IneligibleReasonsHelper | ||
def ineligible_reasons(cfe_result) | ||
return "" unless cfe_result.assessment_result == "ineligible" | ||
|
||
reasons = ineligible_reasons_array(cfe_result) | ||
return ineligible_reason(reasons.first) if reasons.length == 1 | ||
|
||
ineligible_reasons = ":<ul class='govuk-list govuk-list--bullet'>" | ||
reasons.each do |reason| | ||
ineligible_reasons += "<li>#{ineligible_reason(reason)}</li>" | ||
end | ||
ineligible_reasons += "</ul>" | ||
end | ||
|
||
private | ||
|
||
def ineligible_reason(reason) | ||
t("shared.ineligible_reasons.#{reason}") | ||
end | ||
|
||
def ineligible_reasons_array(cfe_result) | ||
ineligible_reasons_array = [] | ||
ineligible_reasons_array << "gross_income" if cfe_result.ineligible_gross_income? | ||
ineligible_reasons_array << "disposable_income" if cfe_result.ineligible_disposable_income? | ||
ineligible_reasons_array << "disposable_capital" if cfe_result.ineligible_disposable_capital? | ||
ineligible_reasons_array | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,33 @@ | ||
module CFE | ||
module V6 | ||
class Result < CFE::V4::Result | ||
def gross_income_results | ||
gross_income_proceeding_types.pluck(:result) | ||
end | ||
|
||
def disposable_income_results | ||
disposable_income_proceeding_types.pluck(:result) | ||
end | ||
|
||
def capital_proceeding_types | ||
capital_summary[:proceeding_types] | ||
end | ||
|
||
def capital_results | ||
capital_proceeding_types.pluck(:result) | ||
end | ||
|
||
def ineligible_gross_income? | ||
gross_income_results.all?("ineligible") | ||
end | ||
|
||
def ineligible_disposable_income? | ||
disposable_income_results.all?("ineligible") | ||
end | ||
|
||
def ineligible_disposable_capital? | ||
capital_results.all?("ineligible") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.