#757: create "published_container" scope
This commit is contained in:
parent
418a138b37
commit
5234b7cc51
|
@ -117,7 +117,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
results = []
|
||||
platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
|
||||
|
||||
bl = BuildList.where(:id => params[:term], :container_status => BuildList::BUILD_PUBLISHED).first
|
||||
bl = BuildList.where(:id => params[:term]).published_container.first
|
||||
results << {:id => "#{bl.id}-build-list", :value => bl.id, :label => "#{bl.id} (#{bl.project.name} - #{bl.arch.name})"} if bl
|
||||
render json: results.to_json
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
def add_extra
|
||||
if params[:extra_id] =~ /-build-list$/
|
||||
id = params[:extra_id].gsub(/-build-list$/, '')
|
||||
subject = BuildList.where(:id => id, :container_status => BuildList::BUILD_PUBLISHED).first
|
||||
subject = BuildList.where(:id => id).published_container.first
|
||||
else
|
||||
subject = Repository.find params[:extra_id]
|
||||
end
|
||||
|
|
|
@ -127,6 +127,7 @@ class BuildList < ActiveRecord::Base
|
|||
scope :scoped_to_project_name, lambda {|project_name| joins(:project).where('projects.name LIKE ?', "%#{project_name}%")}
|
||||
scope :scoped_to_new_core, lambda {|new_core| where(:new_core => new_core)}
|
||||
scope :outdated, where('created_at < ? AND status <> ? OR created_at < ?', Time.now - LIVE_TIME, BUILD_PUBLISHED, Time.now - MAX_LIVE_TIME)
|
||||
scope :published_container, where(:container_status => BUILD_PUBLISHED)
|
||||
|
||||
serialize :additional_repos
|
||||
serialize :include_repos
|
||||
|
@ -477,7 +478,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def check_extra_containers
|
||||
if extra_containers.present? && BuildList.where(:id => extra_containers, :container_status => BUILD_PUBLISHED).count != extra_containers.count
|
||||
if extra_containers.present? && BuildList.where(:id => extra_containers).published_container.count != extra_containers.count
|
||||
errors.add(:extra_containers, I18n.t('flash.build_list.wrong_extra_containers'))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue