Skip to content

Commit

Permalink
Merge pull request #124 from epimorphics/issue/118-input-error-identi…
Browse files Browse the repository at this point in the history
…fication

updates step 3/7 to return user input
  • Loading branch information
DanielCouzens authored Aug 14, 2024
2 parents 5f906b6 + ac1dd27 commit 3847d68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.5.3 - 2024-08

- (Dan) Updates step 3/7 to return user input rather than false when user inputs invalid value [118](https://github.com/epimorphics/standard-reports-ui/issues/118)
- (Dan) Adds underline text to laning page of standard reports and to help link[114](https://github.com/epimorphics/standard-reports-ui/issues/114)
- (Dan) Styled the help button to match PPD [117](https://github.com/epimorphics/standard-reports-ui/issues/117)
- (Dan) Adds more descriptive text to action buttons on the report page [115](https://github.com/epimorphics/standard-reports-ui/issues/115)
Expand Down
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 3847d68

Please sign in to comment.