-
Notifications
You must be signed in to change notification settings - Fork 289
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
Fixes #14933 - Content Host Counts column on the Errata page should o… #6017
Conversation
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
self.content_facets_applicable.joins(:host) | ||
def hosts_applicable(org_id) | ||
if org_id.present? | ||
self.content_facets_applicable.where(:host_id => ::Host.where(:organization_id => org_id)).joins(:host) |
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.
I think you could do something like:
self.content_facets_applicable.joins(:host).where("#{::Host.table_name}.organization_id" => org_id)
and that avoids the sub query
@sean797 looks like a couple tests are failing, if you have any trouble feel free to ping me, i'm happy to help. Overall this looks good, just one minor comment. |
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
Thanks for review @jlsherrill, some help with the tests would be appreciated 👍 I'm not sure if theres a better way of doing |
[test] - old test results aren't there 👎 http://ci.theforeman.org/job/test_katello_pr_core/2313/ |
refute_includes @bugfix.hosts_available, @host_without_errata | ||
assert_includes @security.hosts_available(::Organization.first.id), @host.content_facet | ||
refute_includes @security.hosts_available(::Organization.first.id), @host_without_errata | ||
refute_includes @bugfix.hosts_available(::Organization.first.id), @host_without_errata |
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.
I think one of the tests is failing because here you'd want to pass in @host.organization.id (rather than Organization.first.id.
Could you test for both, i want to make sure that the condition where id is passed in and when its not passed in are both covered.
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.
@host.organization work 👍
To fix your 2nd test failure, just change: https://github.com/Katello/katello/blob/master/test/katello_test_helper.rb#L198-L199 to:
|
Thanks for you help with the tests @jlsherrill! There passing now 👍 |
ACK thanks @sean797 merging! |
…nly count hosts in the current org
If organization_id is supplied we only return applicable & available hosts in that org, if it isn't supplied we keep the current behavior and count all hosts across every org.
I#m not sure if we should be requiring organization_id to be supplied with this API GET /katello/api/errata ?