#977: update BuildList::Item and BuildList::Package models
This commit is contained in:
parent
dc5af30a9a
commit
133210ae0e
|
@ -18,7 +18,7 @@ class BuildList::Item < ActiveRecord::Base
|
|||
BuildList::BUILD_CANCELED => :build_canceled
|
||||
}
|
||||
|
||||
scope :recent, order("level ASC, name ASC")
|
||||
scope :recent, order("#{table_name}.level ASC, #{table_name}.name ASC")
|
||||
|
||||
def self.group_by_level
|
||||
items = scoped({}).recent
|
||||
|
|
|
@ -13,14 +13,14 @@ class BuildList::Package < ActiveRecord::Base
|
|||
validates :package_type, :inclusion => PACKAGE_TYPES
|
||||
validates :sha1, :presence => true, :if => Proc.new { |p| p.build_list.new_core? }
|
||||
|
||||
default_scope order('lower(build_list_packages.name) ASC, length(build_list_packages.name) ASC')
|
||||
default_scope order("lower(#{table_name}.name) ASC, length(#{table_name}.name) ASC")
|
||||
|
||||
# Fetches only actual (last publised) packages.
|
||||
scope :actual, where(:actual => true)
|
||||
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
|
||||
scope :by_name, lambda {|name| where(:name => name) }
|
||||
scope :by_package_type, lambda {|type| where(:package_type => type) }
|
||||
scope :like_name, lambda {|name| where('build_list_packages.name ILIKE ?', "%#{name}%") if name.present?}
|
||||
scope :like_name, lambda {|name| where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present?}
|
||||
|
||||
def assignee
|
||||
project.maintainer
|
||||
|
|
Loading…
Reference in New Issue