-
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
Fix: convert string representation of sizes to numbers when generating SQL for expression #18649
Fix: convert string representation of sizes to numbers when generating SQL for expression #18649
Conversation
18d1ccc
to
3305ecc
Compare
lib/miq_expression.rb
Outdated
# check operands to see if they can be represented in sql | ||
unless sql_supports_atom?(exp) | ||
if sql_supports_atom?(exp) | ||
convert_bytes_untits(exp) if %w[= != <= >= >].include?(operator) |
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.
Small typo on method name. Should be convert_bytes_units
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.
@gtanzillo renamed to slightly more descriptive - convert_size_in_units_to_integer
3305ecc
to
77b8238
Compare
77b8238
to
a11845f
Compare
Checked commits yrudman/manageiq@a84aac1~...a11845f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…n-expression Fix: convert string representation of sizes to numbers when generating SQL for expression (cherry picked from commit db74833) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1702077
Hammer backport details:
|
@miq-bot add-label changelog/yes |
Issue:
New Expression editor allows to select unit of measurement for some field (like MB, GB, etc...) and those units saved in expression. Example:
{"<"=>{"field"=>"ManageIQ::Providers::InfraManager::Vm-allocated_disk_storage", "value"=>"2.gigabytes"}}
However, during SQL generation "2.gigabytes" was not converting to Integer:
FIX:
Convert human representation of sizes to Integer
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1696412
@miq-bot add-label bug, reporting, hammer/yes