[refs #462] refactoring: remove notified_at

This commit is contained in:
Vladimir Sharshov 2012-06-28 21:40:32 +04:00
parent 46161253ab
commit 7561abca08
8 changed files with 28 additions and 23 deletions

View File

@ -11,14 +11,13 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
before_filter :find_product_build_list, :only => [:status_build]
def create
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}", :notified_at => Time.current
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}"
flash[:notice] = t('flash.product.build_started')
redirect_to [@platform, @product]
end
def status_build
@product_build_list.status = params[:status].to_i # ProductBuildList::BUILD_COMPLETED : ProductBuildList::BUILD_FAILED)
@product_build_list.notified_at = Time.current
@product_build_list.save!
render :nothing => true
end

View File

@ -20,11 +20,11 @@ class ProductBuildList < ActiveRecord::Base
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
attr_accessor :base_url
attr_accessible :status, :notified_at, :base_url
attr_accessible :status, :base_url
attr_readonly :product_id
scope :default_order, order('notified_at DESC')
scope :default_order, order('updated_at DESC')
scope :for_status, lambda {|status| where(:status => status) }
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :scoped_to_product_name, lambda {|product_name| joins(:product).where('products.name LIKE ?', "%#{product_name}%")}

View File

@ -3,6 +3,5 @@
%td= product_build_list.human_status
%td= link_to nil, product_build_list.container_path
%td= link_to product_build_list.product.name, platform_product_path(product_build_list.product.platform, product_build_list.product)
-#%td= link_to product_build_list.user.try(:fullname), product_build_list.user
%td= link_to image_tag('x.png'), platform_product_product_build_list_path(product_build_list.product.platform, product_build_list.product, product_build_list), :method => :delete, :confirm => t("layout.confirm") if can? :destroy, product_build_list
%td= l(product_build_list.notified_at, :format => :long)
%td= l(product_build_list.updated_at, :format => :long)

View File

@ -6,7 +6,6 @@
%th.lpadding16= t("activerecord.attributes.product_build_list.status")
%th.lpadding16= t("activerecord.attributes.product_build_list.container_path")
%th.lpadding16= t("activerecord.attributes.product_build_list.product")
-#%th.lpadding16= t("activerecord.attributes.product_build_list.user")
%th= t("layout.product_build_lists.action")
%th.lpadding16= t("activerecord.attributes.product_build_list.notified_at")
%tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product_build_lists

View File

@ -10,7 +10,7 @@ en:
'2': 'build in progress'
build_failed: Build failed
build_started: Build in progress
build_completed: Build
build_completed: Builded
ownership:
header: Build list ownership

View File

@ -0,0 +1,9 @@
class RemoveProductNotifiedAt < ActiveRecord::Migration
def up
remove_column :product_build_lists, :notified_at
end
def down
add_column :product_build_lists, :notified_at, :datetime
end
end

View File

@ -11,14 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120622092725) do
ActiveRecord::Schema.define(:version => 20120628165702) 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"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "advisories", :force => true do |t|
@ -223,7 +223,7 @@ ActiveRecord::Schema.define(:version => 20120622092725) do
t.string "owner_type"
t.string "visibility", :default => "open", :null => false
t.string "platform_type", :default => "main", :null => false
t.string "distrib_type"
t.string "distrib_type", :null => false
end
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
@ -240,7 +240,6 @@ ActiveRecord::Schema.define(:version => 20120622092725) do
create_table "product_build_lists", :force => true do |t|
t.integer "product_id"
t.integer "status", :default => 2, :null => false
t.datetime "notified_at"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -294,25 +293,27 @@ ActiveRecord::Schema.define(:version => 20120622092725) 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_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false
end
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
create_table "register_requests", :force => true do |t|
t.string "name"
t.string "email"
t.string "token"
t.boolean "approved", :default => false
t.boolean "rejected", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "interest"
t.text "more"
end
@ -366,7 +367,6 @@ ActiveRecord::Schema.define(:version => 20120622092725) 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 "remember_created_at"
t.datetime "created_at"
@ -374,11 +374,8 @@ ActiveRecord::Schema.define(:version => 20120622092725) do
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience"
t.string "site"
t.string "company"
@ -390,6 +387,9 @@ ActiveRecord::Schema.define(:version => 20120622092725) do
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "authentication_token"
t.integer "build_priority", :default => 50
end

View File

@ -21,7 +21,6 @@ describe ProductBuildList do
it { should_not allow_mass_assignment_of(:product_id) }
it { should allow_mass_assignment_of(:status) }
it { should allow_mass_assignment_of(:notified_at) }
it { should allow_mass_assignment_of(:base_url) }
end