Skip to content

Commit

Permalink
updates step 3/7 to return user input
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCouzens committed Aug 14, 2024
1 parent ca36948 commit fb026f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/models/step_select_county_or_district.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ def traverse(workflow)
end

def validate_value(workflow)
input_text = value(workflow)
normalized_value = validate(value(workflow))
unless normalized_value && (value(workflow) == normalized_value)
workflow.set_state(param_name, normalized_value)
workflow.set_state(param_name, input_text)
end

normalized_value || validation_failure(workflow)
normalized_value || validation_failure(input_text)
end

def validation_failure(workflow)
set_flash("Sorry, #{subtype_label} '#{value(workflow)}' was not recognised")
def validation_failure(input_text)
set_flash("Sorry, #{subtype_label} '#{input_text}' was not recognised")
false
end

Expand Down

0 comments on commit fb026f2

Please sign in to comment.