[refs #223] Add current duration and project average build time
This commit is contained in:
parent
26a468f6e3
commit
65f1cfc822
|
@ -139,6 +139,14 @@ class BuildList < ActiveRecord::Base
|
|||
{:project => project.name, :version => project_version, :arch => arch.name}.inspect
|
||||
end
|
||||
|
||||
def current_duration
|
||||
(Time.now - started_at).to_i
|
||||
end
|
||||
|
||||
def human_current_duration
|
||||
I18n.t("layout.build_lists.human_current_duration", {:minutes => (current_duration/60).to_i, :seconds => (current_duration%60).to_i})
|
||||
end
|
||||
|
||||
def human_duration
|
||||
I18n.t("layout.build_lists.human_duration", {:minutes => (duration/60).to_i, :seconds => (duration%60).to_i})
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class BuildListObserver < ActiveRecord::Observer
|
|||
record.started_at = Time.now if record.status == BuildServer::BUILD_STARTED
|
||||
if [BuildServer::BUILD_ERROR, BuildServer::SUCCESS].include? record.status
|
||||
# stores time interval beetwin build start and finish in seconds
|
||||
record.duration = (Time.now - record.started_at).to_i
|
||||
record.duration = record.current_duration
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -203,6 +203,15 @@ class Project < ActiveRecord::Base
|
|||
recipients
|
||||
end
|
||||
|
||||
def average_build_time
|
||||
build_lists.where(:status => BuildServer::SUCCESS).average(:duration)
|
||||
end
|
||||
|
||||
def human_average_build_time
|
||||
time = average_build_time
|
||||
I18n.t("layout.projects.human_average_build_time", :minutes => (time/60).to_i, :seconds => (time%60).to_i)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def build_path(dir)
|
||||
|
|
|
@ -57,6 +57,15 @@
|
|||
.leftside.width125
|
||||
.leftside= @build_list.human_duration
|
||||
.both
|
||||
- if !@build_list.finished? && @build_list.started_at
|
||||
%br
|
||||
.leftside.width125
|
||||
.leftside= @build_list.human_current_duration
|
||||
.both
|
||||
.leftside.width125
|
||||
.leftside= @build_list.project.human_average_build_time
|
||||
.both
|
||||
|
||||
.hr
|
||||
%h3= t("layout.build_lists.items_header")
|
||||
- if @item_groups.blank?
|
||||
|
|
|
@ -61,6 +61,7 @@ en:
|
|||
new_header: New build
|
||||
main_data: Main data
|
||||
human_duration: Build lasted %{minutes} minutes %{seconds} seconds
|
||||
human_current_duration: Build currently takes %{minutes} minutes %{seconds} seconds
|
||||
|
||||
ownership:
|
||||
header: Build list ownership
|
||||
|
|
|
@ -60,6 +60,7 @@ ru:
|
|||
new_header: Новая сборка
|
||||
main_data: Основные данные
|
||||
human_duration: Сборка продлилась %{minutes} минут %{seconds} секунд
|
||||
human_current_duration: Сборка длится уже %{minutes} минут %{seconds} секунд
|
||||
|
||||
ownership:
|
||||
header: Принадлежность заданий
|
||||
|
|
|
@ -33,6 +33,7 @@ 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: Average build time is %{minutes} minutes %{seconds} seconds
|
||||
|
||||
git_help:
|
||||
cloning: Cloning the repository
|
||||
|
|
|
@ -33,6 +33,7 @@ ru:
|
|||
sections: Разделы
|
||||
has_issue_description: Трэкер предоставляет лекговесный менеджер для задач по разработке Вашего проекта.
|
||||
has_wiki_description: Wiki - это самый простой способ предоставить другим вносить свой вклад в развитие Вашего проекта. Каждый пользователь нашего сервиса может использовать Wiki для документирования, примеров, поддержки или всего другого, в чем у Вас появится необходимость.
|
||||
human_average_build_time: Среднее время сборки %{minutes} минут %{seconds} секунд
|
||||
|
||||
diff_show_header: "%{files} с %{additions} и %{deletions}."
|
||||
about_subheader: "О проекте"
|
||||
|
|
Loading…
Reference in New Issue