Skip to content
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

Merged
merged 1 commit into from
Jul 18, 2017

Conversation

syncrou
Copy link
Contributor

@syncrou syncrou commented Jul 14, 2017

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

@syncrou
Copy link
Contributor Author

syncrou commented Jul 14, 2017

@miq-bot add_label wip, bug

@miq-bot assign @gmcculloug

@miq-bot miq-bot changed the title Validate if we have an array of integers [WIP] Validate if we have an array of integers Jul 14, 2017
@syncrou
Copy link
Contributor Author

syncrou commented Jul 17, 2017

@miq-bot remove_label wip

@gmcculloug - The PR reflects the changes we chatted about.

@miq-bot miq-bot changed the title [WIP] Validate if we have an array of integers Validate if we have an array of integers Jul 17, 2017
@miq-bot miq-bot removed the wip label Jul 17, 2017
@@ -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])
Copy link
Member

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
@miq-bot
Copy link
Member

miq-bot commented Jul 18, 2017

Checked commit syncrou@5107240 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 6 offenses detected

app/models/miq_request_workflow.rb

Copy link
Member

@gmcculloug gmcculloug left a 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.

@gmcculloug gmcculloug merged commit 94fd0b8 into ManageIQ:master Jul 18, 2017
@gmcculloug gmcculloug added this to the Sprint 65 Ending Jul 24, 2017 milestone Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants