[Refs #66] Add priority in build list
This commit is contained in:
parent
56f1d06da8
commit
d3c3726a84
|
@ -8,6 +8,8 @@ class BuildList < ActiveRecord::Base
|
|||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
|
||||
validates :project_id, :project_version, :arch, :include_repos, :presence => true
|
||||
validates_numericality_of :priority, :greater_than_or_equal_to => 0
|
||||
|
||||
UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage]
|
||||
validates :update_type, :inclusion => UPDATE_TYPES
|
||||
validate lambda {
|
||||
|
@ -57,10 +59,10 @@ class BuildList < ActiveRecord::Base
|
|||
}
|
||||
|
||||
scope :recent, order("#{table_name}.updated_at DESC")
|
||||
scope :current, lambda {
|
||||
outdatable_statuses = [BuildServer::SUCCESS, BuildServer::ERROR, BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_PENDING, BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND]
|
||||
where(["status in (?) OR (status in (?) AND notified_at >= ?)", [WAITING_FOR_RESPONSE, BUILD_PENDING, BuildServer::BUILD_STARTED], outdatable_statuses, Time.now - 2.days])
|
||||
}
|
||||
# scope :current, lambda {
|
||||
# outdatable_statuses = [BuildServer::SUCCESS, BuildServer::ERROR, BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_PENDING, BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND]
|
||||
# where(["status in (?) OR (status in (?) AND notified_at >= ?)", [WAITING_FOR_RESPONSE, BUILD_PENDING, BuildServer::BUILD_STARTED], outdatable_statuses, Time.now - 2.days])
|
||||
# }
|
||||
scope :for_status, lambda {|status| where(:status => status) }
|
||||
scope :for_user, lambda { |user| where(:user_id => user.id) }
|
||||
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
|
||||
|
@ -144,8 +146,8 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def place_build
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos
|
||||
self.status = BuildServer.add_build_list project.name, project_version, pl.name, arch.name, (pl_id == bpl_id ? '' : bpl.name), update_type, build_requires, id, include_repos, 5
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority
|
||||
self.status = BuildServer.add_build_list project.name, project_version, pl.name, arch.name, (pl_id == bpl_id ? '' : bpl.name), update_type, build_requires, id, include_repos, priority
|
||||
self.status = BUILD_PENDING if self.status == 0
|
||||
save
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddBuildListPriority < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :build_lists, :priority, :integer, :null => false, :default => 0
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :build_lists, :priority
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -11,14 +11,14 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120314223151) do
|
||||
ActiveRecord::Schema.define(:version => 20120320102912) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
|
@ -83,6 +83,7 @@ ActiveRecord::Schema.define(:version => 20120314223151) do
|
|||
t.boolean "auto_publish", :default => true
|
||||
t.string "package_version"
|
||||
t.string "commit_hash"
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
end
|
||||
|
||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
|
@ -285,11 +286,11 @@ ActiveRecord::Schema.define(:version => 20120314223151) do
|
|||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "srpm_file_name"
|
||||
t.string "srpm_content_type"
|
||||
t.integer "srpm_file_size"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "default_branch", :default => "master"
|
||||
t.boolean "is_rpm", :default => true
|
||||
end
|
||||
|
@ -310,6 +311,7 @@ ActiveRecord::Schema.define(:version => 20120314223151) do
|
|||
end
|
||||
|
||||
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
|
||||
add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "relations", :force => true do |t|
|
||||
t.integer "object_id"
|
||||
|
@ -368,16 +370,16 @@ ActiveRecord::Schema.define(:version => 20120314223151) do
|
|||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
|
Loading…
Reference in New Issue