#245: remove average_build_time and build_count columns from Project

This commit is contained in:
Vokhmin Alexey V 2013-07-31 17:08:43 +04:00
parent 5a660ded4e
commit b796299f60
8 changed files with 60 additions and 11 deletions

View File

@ -290,6 +290,18 @@ class BuildList < ActiveRecord::Base
BuildList.where(:id => extra_build_lists).where('status != ?', BUILD_PUBLISHED).count == 0
end
def human_average_build_time
I18n.t('layout.project_statistics.human_average_build_time', {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i})
end
def formatted_average_build_time
"%02d:%02d" % [average_build_time / 3600, average_build_time % 3600 / 60]
end
def average_build_time
project.project_statistics.where(:arch_id => arch_id).first || 0
end
def self.human_status(status)
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
end

View File

@ -194,13 +194,13 @@ class Project < ActiveRecord::Base
end
end
def human_average_build_time
I18n.t("layout.projects.human_average_build_time", {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i})
end
# def human_average_build_time
# I18n.t("layout.projects.human_average_build_time", {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i})
# end
def formatted_average_build_time
"%02d:%02d" % [average_build_time / 3600, average_build_time % 3600 / 60]
end
# def formatted_average_build_time
# "%02d:%02d" % [average_build_time / 3600, average_build_time % 3600 / 60]
# end
def destroy_project_from_repository(repository)
AbfWorker::BuildListsPublishTaskManager.destroy_project_from_repository self, repository

View File

@ -47,7 +47,6 @@ en:
sections: Sections
has_issue_description: Tracker adds a lightweight issue management system tightly integrated with your repository.
has_wiki_description: Wikis are the simplest way to allow other users to contribute content. Any user can create and edit pages for documentation, examples, support or anything you wish.
human_average_build_time: Expected time is %{hours} h. %{minutes} min.
git_global_setup: Git global setup
create_repository: Create Repository
move_files_to_folder: Move files you need to the project or create them.

View File

@ -47,7 +47,6 @@ ru:
sections: Разделы
has_issue_description: Трэкер предоставляет лекговесный менеджер для задач по разработке Вашего проекта.
has_wiki_description: Wiki - это самый простой способ предоставить другим вносить свой вклад в развитие Вашего проекта. Каждый пользователь нашего сервиса может использовать Wiki для документирования, примеров, поддержки или всего другого, в чем у Вас появится необходимость.
human_average_build_time: 'Ожидаемое время: %{hours} ч. %{minutes} мин.'
git_global_setup: Общие настройки Git
create_repository: Создание репозитория
move_files_to_folder: Переместите нужные файлы в проект или создайте их.

View File

@ -0,0 +1,14 @@
en:
layout:
project_statistics:
human_average_build_time: Expected time is %{hours} h. %{minutes} min.
flash:
project_statistic:
activerecord:
models:
project_statistic: Project statistic
attributes:
project_statistic:

View File

@ -0,0 +1,16 @@
ru:
layout:
project_statistics:
human_average_build_time: 'Ожидаемое время: %{hours} ч. %{minutes} мин.'
flash:
project_statistic:
activerecord:
models:
project_statistic: Статистика проекта
attributes:
project_statistic:

View File

@ -0,0 +1,11 @@
class DropAverageBuildTimeAndBuildCountFromProject < ActiveRecord::Migration
def up
remove_column :projects, :average_build_time
remove_column :projects, :build_count
end
def down
add_column :projects, :average_build_time, :integer, :null => false, :default => 0
add_column :projects, :build_count, :integer, :null => false, :default => 0
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130731120901) do
ActiveRecord::Schema.define(:version => 20130731130518) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -423,8 +423,6 @@ ActiveRecord::Schema.define(:version => 20130731120901) do
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
t.integer "maintainer_id"
t.boolean "publish_i686_into_x86_64", :default => false
t.string "owner_uname", :null => false