-
Notifications
You must be signed in to change notification settings - Fork 92
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
Replace conditions with scope #144
Conversation
@@ -28,11 +28,11 @@ def service_group_names | |||
end | |||
|
|||
def service_group_services_running | |||
service_group_services.where(SystemService.running_systemd_services_condition) | |||
SystemService.running_systemd |
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.
Thanks for the PR! Just a note: we want use an association instead of SystemService model to find matching system services.
7128357
to
b08cc7b
Compare
b08cc7b
to
0b5e60d
Compare
@@ -28,11 +28,11 @@ def service_group_names | |||
end | |||
|
|||
def service_group_services_running | |||
service_group_services.where(SystemService.running_systemd_services_condition) | |||
service_group_services.where("(\"system_services\".\"systemd_active\" = 'running' AND \"system_services\".\"systemd_sub\" = 'running')") |
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.
👎
You should just let ActiveRecord do the escaping for you.
.where(:system_services => {:systemd_active => "running", :systemd_sub => "running"})
end | ||
|
||
def service_group_services_failed | ||
service_group_services.where(SystemService.failed_systemd_services_condition) | ||
service_group_services.where("(\"system_services\".\"systemd_active\" = 'failed' OR \"system_services\".\"systemd_sub\" = 'failed')") |
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.
Same
0b5e60d
to
82ad579
Compare
@alexander-demichev Hi, could check the failing Travis? |
@aufi Hi, Travis fails because of unmerged PR in main repo. |
82ad579
to
87bbecf
Compare
87bbecf
to
e6ee2a0
Compare
Checked commit alexander-demicev@e6ee2a0 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Looks good to me! |
This PR depends on ManageIQ/manageiq#16399 (merged) and is needed by ManageIQ/manageiq-ui-classic#2638 (merge pending) |
FYI... for backport, waiting for someone to confirm the dependent PR ManageIQ/manageiq#16399 can be |
Replace sql conditions with scopes.
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1507916