[refs #442] Add counters update checking. Add build_error counter

This commit is contained in:
konstantin.grabar 2012-06-27 13:48:54 +04:00
parent bdb97b8891
commit fc00f713b5
5 changed files with 15 additions and 3 deletions

View File

@ -105,9 +105,9 @@ class BuildList < ActiveRecord::Base
around_transition do |build_list, transition, block|
if build_list.mass_build
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id if MassBuild::COUNT_STATUSES.include?(build_list.status)
block.call
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id if MassBuild::COUNT_STATUSES.include?(build_list.status)
end
end

View File

@ -12,6 +12,15 @@ class MassBuild < ActiveRecord::Base
after_create :build_all
COUNT_STATUSES = [
:build_lists,
:build_published,
:build_pending,
:build_started,
:build_publish,
:build_error
]
def initialize(args = nil)
super

View File

@ -35,6 +35,7 @@
%th.lpadding16= t("layout.build_lists.statuses.build_pending").camelize
%th.lpadding16= t("layout.build_lists.statuses.build_started").camelize
%th.lpadding16= t("layout.build_lists.statuses.build_publish").camelize
%th.lpadding16= t("layout.build_lists.statuses.build_error").camelize
%th.lpadding16= t("layout.mass_builds.extended_data")
- @mass_builds.each do |mass_build|
%tr
@ -45,6 +46,7 @@
%td= mass_build.build_pending_count
%td= mass_build.build_started_count
%td= mass_build.build_publish_count
%td= mass_build.build_error_count
%td
%a{:href => '#', :'data-toggle' => "collapse", :'data-target' => "#collapse_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
.in.collapse{:id => "collapse_#{ mass_build.id }"}

View File

@ -2,7 +2,7 @@ ru:
layout:
mass_builds:
repositories: Репозитории
extended_data: Дополнительные данные
extended_data: Параметры задания
activerecord:
models:
mass_build: Массовая Сборка

View File

@ -5,5 +5,6 @@ class AddCountersToMassBuilds < ActiveRecord::Migration
add_column :mass_builds, :build_pending_count, :integer, :default => 0
add_column :mass_builds, :build_started_count, :integer, :default => 0
add_column :mass_builds, :build_publish_count, :integer, :default => 0
add_column :mass_builds, :build_error_count, :integer, :default => 0
end
end