-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate if we have an array of integers #15572
Conversation
@miq-bot add_label wip, bug @miq-bot assign @gmcculloug |
b465aa0
to
83d51ee
Compare
@miq-bot remove_label wip @gmcculloug - The PR reflects the changes we chatted about. |
app/models/miq_request_workflow.rb
Outdated
@@ -143,8 +143,7 @@ def validate(values) | |||
|
|||
# Check the disabled flag here so we reset the "error" value on each field | |||
next if dialog_disabled || fld[:display] == :hide | |||
|
|||
value = get_value(values[f]) | |||
value = fld[:data_type].to_s.match('array_') ? values[f] : get_value(values[f]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following rubocop here and suggest we change this to =~
since we are not using the returned MatchData
object. It also removes the need for to_s
.
The get_value method was always returning the first value if an array was passed in. This change modifies the logic to return the original data if an array of integers is passed in or if a non array is passed in. Without this change, the validation on the dialog was failing for the array_integer type
83d51ee
to
5107240
Compare
Checked commit syncrou@5107240 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/models/miq_request_workflow.rb
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remaining rubocop issues are related to older code that was just moved into a method.
The
get_value
method was always returning the first value if an array was passed in.This change modifies the logic to return the original data if an array of integers is passed in or
if a non array is passed in.
Without this change, the validation on the dialog was failing for the
array_integer
type as seen from Travis