Skip to content

Commit

Permalink
Merge pull request #2964 from bitzesty/a11y-radio
Browse files Browse the repository at this point in the history
Sets from and to variables for error method in RecentFinancialYearQuestion
  • Loading branch information
TheDancingClown authored Jun 14, 2024
2 parents 4561fe5 + 512dd99 commit 3903fb3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
class QaeFormBuilder
class TradeMostRecentFinancialYearOptionsQuestionValidator < OptionsQuestionValidator
def errors
result = {}

date, range = question.get_changeable_date_range

if date.present? && range.present? && !date.in?(range) && question.year_has_changed?
result[question.key] = "You can only change the year if your dates in question D2 range between #{from.decorate.formatted_trigger_date} to #{to.decorate.formatted_trigger_date}."
end

result
end
end

class TradeMostRecentFinancialYearOptionsQuestionBuilder < OptionsQuestionBuilder
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/form_answer_innovation.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,6 @@
"head_job_title": "test",
"head_email": "test",
"strong_esg_record": "on",
"major_issues_overcome": "test"
"major_issues_overcome": "test",
"most_recent_financial_year": "2024"
}
3 changes: 2 additions & 1 deletion spec/fixtures/form_answer_trade.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,6 @@
"head_job_title": "test",
"head_email": "test",
"strong_esg_record": "on",
"major_issues_overcome": "test"
"major_issues_overcome": "test",
"most_recent_financial_year": "2024"
}

0 comments on commit 3903fb3

Please sign in to comment.