#435: added reopen status for issues
This commit is contained in:
parent
fac4f5638b
commit
6b6e73b925
|
@ -156,6 +156,7 @@ RosaABF.controller 'StatisticsController', ['$scope', '$http', '$timeout', ($sco
|
||||||
$scope.initIssuesChart = ->
|
$scope.initIssuesChart = ->
|
||||||
$scope.dateChart '#issues_chart', [
|
$scope.dateChart '#issues_chart', [
|
||||||
$scope.statistics.issues.open,
|
$scope.statistics.issues.open,
|
||||||
|
$scope.statistics.issues.reopen,
|
||||||
$scope.statistics.issues.closed
|
$scope.statistics.issues.closed
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Issue < ActiveRecord::Base
|
||||||
|
|
||||||
STATUSES = [
|
STATUSES = [
|
||||||
STATUS_OPEN = 'open',
|
STATUS_OPEN = 'open',
|
||||||
|
STATUS_REOPEN = 'reopen',
|
||||||
STATUS_CLOSED = 'closed'
|
STATUS_CLOSED = 'closed'
|
||||||
]
|
]
|
||||||
HASH_TAG_REGEXP = /([a-zA-Z0-9\-_]*\/)?([a-zA-Z0-9\-_]*)?#([0-9]+)/
|
HASH_TAG_REGEXP = /([a-zA-Z0-9\-_]*\/)?([a-zA-Z0-9\-_]*)?#([0-9]+)/
|
||||||
|
@ -46,10 +47,10 @@ class Issue < ActiveRecord::Base
|
||||||
attr_accessible :labelings_attributes, :title, :body, :assignee_id
|
attr_accessible :labelings_attributes, :title, :body, :assignee_id
|
||||||
accepts_nested_attributes_for :labelings, allow_destroy: true
|
accepts_nested_attributes_for :labelings, allow_destroy: true
|
||||||
|
|
||||||
scope :opened, -> { where(status: STATUS_OPEN) }
|
scope :opened, -> { where(status: [STATUS_OPEN, STATUS_REOPEN]) }
|
||||||
scope :closed, -> { where(status: STATUS_CLOSED) }
|
scope :closed, -> { where(status: STATUS_CLOSED) }
|
||||||
|
|
||||||
scope :needed_checking, -> { where(issues: { status: %w(open blocked ready already) }) }
|
scope :needed_checking, -> { where(issues: { status: %w(open reopen blocked ready already) }) }
|
||||||
scope :not_closed_or_merged, -> { needed_checking }
|
scope :not_closed_or_merged, -> { needed_checking }
|
||||||
scope :closed_or_merged, -> { where(issues: { status: %w(closed merged) }) }
|
scope :closed_or_merged, -> { where(issues: { status: %w(closed merged) }) }
|
||||||
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
|
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
|
||||||
|
@ -62,6 +63,16 @@ class Issue < ActiveRecord::Base
|
||||||
|
|
||||||
attr_accessor :new_pull_request
|
attr_accessor :new_pull_request
|
||||||
|
|
||||||
|
state_machine :status, initial: :open do
|
||||||
|
event :reopen do
|
||||||
|
transition closed: :reopen
|
||||||
|
end
|
||||||
|
|
||||||
|
event :close do
|
||||||
|
transition [:open, :reopen] => :closed
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def assign_uname
|
def assign_uname
|
||||||
assignee.uname if assignee
|
assignee.uname if assignee
|
||||||
end
|
end
|
||||||
|
@ -83,12 +94,12 @@ class Issue < ActiveRecord::Base
|
||||||
def set_close(closed_by)
|
def set_close(closed_by)
|
||||||
self.closed_at = Time.now.utc
|
self.closed_at = Time.now.utc
|
||||||
self.closer = closed_by
|
self.closer = closed_by
|
||||||
self.status = STATUS_CLOSED
|
close(false) # skip the saving
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_open
|
def set_open
|
||||||
self.closed_at = self.closed_by = nil
|
self.closed_at = self.closed_by = nil
|
||||||
self.status = STATUS_OPEN
|
reopen(false) # skip the saving
|
||||||
end
|
end
|
||||||
|
|
||||||
def collect_recipients
|
def collect_recipients
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Statistic < ActiveRecord::Base
|
||||||
KEY_BUILD_LIST_BUILD_PUBLISHED = "#{KEY_BUILD_LIST}.#{BuildList::BUILD_PUBLISHED}",
|
KEY_BUILD_LIST_BUILD_PUBLISHED = "#{KEY_BUILD_LIST}.#{BuildList::BUILD_PUBLISHED}",
|
||||||
KEY_ISSUE = 'issue',
|
KEY_ISSUE = 'issue',
|
||||||
KEY_ISSUES_OPEN = "#{KEY_ISSUE}.#{Issue::STATUS_OPEN}",
|
KEY_ISSUES_OPEN = "#{KEY_ISSUE}.#{Issue::STATUS_OPEN}",
|
||||||
|
KEY_ISSUES_REOPEN = "#{KEY_ISSUE}.#{Issue::STATUS_REOPEN}",
|
||||||
KEY_ISSUES_CLOSED = "#{KEY_ISSUE}.#{Issue::STATUS_CLOSED}",
|
KEY_ISSUES_CLOSED = "#{KEY_ISSUE}.#{Issue::STATUS_CLOSED}",
|
||||||
KEY_PULL_REQUEST = 'pull_request',
|
KEY_PULL_REQUEST = 'pull_request',
|
||||||
KEY_PULL_REQUESTS_OPEN = "#{KEY_PULL_REQUEST}.#{PullRequest::STATUS_OPEN}",
|
KEY_PULL_REQUESTS_OPEN = "#{KEY_PULL_REQUEST}.#{PullRequest::STATUS_OPEN}",
|
||||||
|
@ -75,6 +76,7 @@ class Statistic < ActiveRecord::Base
|
||||||
scope :build_lists_published, -> { where(key: KEY_BUILD_LIST_BUILD_PUBLISHED) }
|
scope :build_lists_published, -> { where(key: KEY_BUILD_LIST_BUILD_PUBLISHED) }
|
||||||
scope :commits, -> { where(key: KEY_COMMIT) }
|
scope :commits, -> { where(key: KEY_COMMIT) }
|
||||||
scope :issues_open, -> { where(key: KEY_ISSUES_OPEN) }
|
scope :issues_open, -> { where(key: KEY_ISSUES_OPEN) }
|
||||||
|
scope :issues_reopen, -> { where(key: KEY_ISSUES_REOPEN) }
|
||||||
scope :issues_closed, -> { where(key: KEY_ISSUES_CLOSED) }
|
scope :issues_closed, -> { where(key: KEY_ISSUES_CLOSED) }
|
||||||
scope :pull_requests_open, -> { where(key: KEY_PULL_REQUESTS_OPEN) }
|
scope :pull_requests_open, -> { where(key: KEY_PULL_REQUESTS_OPEN) }
|
||||||
scope :pull_requests_merged, -> { where(key: KEY_PULL_REQUESTS_MERGED) }
|
scope :pull_requests_merged, -> { where(key: KEY_PULL_REQUESTS_MERGED) }
|
||||||
|
|
|
@ -28,9 +28,11 @@ class StatisticPresenter < ApplicationPresenter
|
||||||
},
|
},
|
||||||
issues: {
|
issues: {
|
||||||
open: prepare_collection(issues_open),
|
open: prepare_collection(issues_open),
|
||||||
|
reopen: prepare_collection(issues_reopen),
|
||||||
closed: prepare_collection(issues_closed),
|
closed: prepare_collection(issues_closed),
|
||||||
|
|
||||||
open_count: issues_open.sum(&:count),
|
open_count: issues_open.sum(&:count),
|
||||||
|
reopen_count: issues_reopen.sum(&:count),
|
||||||
closed_count: issues_closed.sum(&:count)
|
closed_count: issues_closed.sum(&:count)
|
||||||
},
|
},
|
||||||
pull_requests: {
|
pull_requests: {
|
||||||
|
@ -66,6 +68,10 @@ class StatisticPresenter < ApplicationPresenter
|
||||||
@issues_open ||= scope.issues_open.to_a
|
@issues_open ||= scope.issues_open.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def issues_reopen
|
||||||
|
@issues_reopen ||= scope.issues_reopen.to_a
|
||||||
|
end
|
||||||
|
|
||||||
def issues_closed
|
def issues_closed
|
||||||
@issues_closed ||= scope.issues_closed.to_a
|
@issues_closed ||= scope.issues_closed.to_a
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
%span.graph-key-color1
|
%span.graph-key-color1
|
||||||
= t('.open_title')
|
= t('.open_title')
|
||||||
%span.graph-key-color2
|
%span.graph-key-color2
|
||||||
|
= t('.reopen_title')
|
||||||
|
%span.graph-key-color3
|
||||||
= t('.closed_title')
|
= t('.closed_title')
|
||||||
.centered.graph-loading{ ng_show: 'loading' }
|
.centered.graph-loading{ ng_show: 'loading' }
|
||||||
= image_tag 'loading-large.gif'
|
= image_tag 'loading-large.gif'
|
||||||
|
@ -27,6 +29,15 @@
|
||||||
= t('.no_data')
|
= t('.no_data')
|
||||||
{{ statistics.issues.open_count | number }}
|
{{ statistics.issues.open_count | number }}
|
||||||
|
|
||||||
|
.panel-wrapper
|
||||||
|
%h3
|
||||||
|
= t('.total_reopen')
|
||||||
|
.panel-data
|
||||||
|
= image_tag 'loading-small.gif', ng_show: 'loading'
|
||||||
|
.no-data{ ng_hide: 'loading || statistics.issues.reopen_count >= 0' }
|
||||||
|
= t('.no_data')
|
||||||
|
{{ statistics.issues.reopen_count | number }}
|
||||||
|
|
||||||
.panel-wrapper
|
.panel-wrapper
|
||||||
%h3
|
%h3
|
||||||
= t('.total_closed')
|
= t('.total_closed')
|
||||||
|
|
|
@ -36,9 +36,11 @@ en:
|
||||||
issues:
|
issues:
|
||||||
header: "Issues"
|
header: "Issues"
|
||||||
open_title: "Open"
|
open_title: "Open"
|
||||||
|
reopen_title: "Reopen"
|
||||||
closed_title: "Closed"
|
closed_title: "Closed"
|
||||||
|
|
||||||
total_open: "Total open"
|
total_open: "Total opened"
|
||||||
|
total_reopen: "Total reopened"
|
||||||
total_closed: "Total closed"
|
total_closed: "Total closed"
|
||||||
no_data: "No data available"
|
no_data: "No data available"
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,11 @@ ru:
|
||||||
issues:
|
issues:
|
||||||
header: "Задачи"
|
header: "Задачи"
|
||||||
open_title: "Открыто"
|
open_title: "Открыто"
|
||||||
|
reopen_title: "Переоткрыто"
|
||||||
closed_title: "Закрыто"
|
closed_title: "Закрыто"
|
||||||
|
|
||||||
total_open: "Всего открыто"
|
total_open: "Всего открыто"
|
||||||
|
total_reopen: "Всего переоткрыто"
|
||||||
total_closed: "Всего закрыто"
|
total_closed: "Всего закрыто"
|
||||||
no_data: "Нет данных"
|
no_data: "Нет данных"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue