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

Fixes #38056 - Refresh content count action fails when count is set to {} #11244

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/models/katello/concerns/smart_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,20 @@ def repos_content_count(repos, reset: false)
end

def initialize_content_counts(reset: false)
if reset
if reset || content_counts.empty?
{ content_view_versions: {} }.with_indifferent_access
else
(content_counts&.deep_dup || { content_view_versions: {} }).with_indifferent_access
content_counts.deep_dup.with_indifferent_access
end
end

def process_repository(repo, content_counts)
repo_mirror_service = repo.backend_service(self).with_mirror_adapter
repo_content_counts = repo_mirror_service.latest_content_counts
translated_counts = translate_counts(repo, repo_mirror_service, repo_content_counts)
content_counts[:content_view_versions][repo.content_view_version_id.to_s] ||= { repositories: {}}
if content_counts[:content_view_versions][repo.content_view_version_id.to_s].empty?
content_counts[:content_view_versions][repo.content_view_version_id.to_s] = { repositories: {}}.with_indifferent_access
end
content_counts[:content_view_versions][repo.content_view_version_id.to_s][:repositories][repo.id.to_s] = translated_counts
end

Expand Down
Loading