Skip to content

Commit

Permalink
Move is_link variable to the place it's used
Browse files Browse the repository at this point in the history
We use the set_package before filter in many controllers
but use the is_link variable only one view. One less database
and one less backend query...
  • Loading branch information
hennevogel committed Sep 22, 2023
1 parent ea4513e commit 8f8a3da
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 392 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class JobHistoryController < Packages::MainController
before_action :set_architecture

def index
@is_link = @package.is_link? || @package.is_local_link?
@jobshistory = @package.jobhistory(repository_name: @repository.name, arch_name: @architecture.name, package_name: @package_name, project_name: @project.name)
end
end
Expand Down
1 change: 0 additions & 1 deletion src/api/app/controllers/webui/packages/main_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def set_package
@package_name = params[:package_name]
@package = ::Package.get_by_project_and_name(@project.to_param, params[:package_name],
use_source: false, follow_project_links: true, follow_multibuild: true)
@is_link = @package.is_link? || @package.is_local_link?
rescue APIError
raise ActiveRecord::RecordNotFound, 'Not Found'
end
Expand Down

0 comments on commit 8f8a3da

Please sign in to comment.