Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
24b23ad8
Commit
24b23ad8
authored
Jun 03, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass int when getting I18n VSA stage summary title
parent
c4bff0ef
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
89 additions
and
30 deletions
+89
-30
changelogs/unreleased/220148-fix-vsa-issue-summary-title.yml
changelogs/unreleased/220148-fix-vsa-issue-summary-title.yml
+5
-0
ee/lib/gitlab/analytics/cycle_analytics/summary/group/deploy.rb
.../gitlab/analytics/cycle_analytics/summary/group/deploy.rb
+1
-1
ee/lib/gitlab/analytics/cycle_analytics/summary/group/issue.rb
...b/gitlab/analytics/cycle_analytics/summary/group/issue.rb
+1
-1
ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_summary_spec.rb
...ytics/cycle_analytics/summary/group/stage_summary_spec.rb
+12
-0
lib/gitlab/cycle_analytics/summary/commit.rb
lib/gitlab/cycle_analytics/summary/commit.rb
+1
-1
lib/gitlab/cycle_analytics/summary/deploy.rb
lib/gitlab/cycle_analytics/summary/deploy.rb
+1
-1
lib/gitlab/cycle_analytics/summary/issue.rb
lib/gitlab/cycle_analytics/summary/issue.rb
+1
-1
lib/gitlab/cycle_analytics/summary/value.rb
lib/gitlab/cycle_analytics/summary/value.rb
+12
-0
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
+55
-25
No files found.
changelogs/unreleased/220148-fix-vsa-issue-summary-title.yml
0 → 100644
View file @
24b23ad8
---
title
:
Fix Value Stream Analytics summary when using non-english locale
merge_request
:
33717
author
:
type
:
fixed
ee/lib/gitlab/analytics/cycle_analytics/summary/group/deploy.rb
View file @
24b23ad8
...
...
@@ -9,7 +9,7 @@ module Gitlab
include
Gitlab
::
CycleAnalytics
::
GroupProjectsProvider
def
title
n_
(
'Deploy'
,
'Deploys'
,
value
)
n_
(
'Deploy'
,
'Deploys'
,
value
.
to_i
)
end
def
value
...
...
ee/lib/gitlab/analytics/cycle_analytics/summary/group/issue.rb
View file @
24b23ad8
...
...
@@ -15,7 +15,7 @@ module Gitlab
end
def
title
n_
(
'New Issue'
,
'New Issues'
,
value
)
n_
(
'New Issue'
,
'New Issues'
,
value
.
to_i
)
end
def
value
...
...
ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_summary_spec.rb
View file @
24b23ad8
...
...
@@ -23,6 +23,12 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageSummary d
expect
(
subject
.
first
[
:value
]).
to
eq
(
'2'
)
end
it
'returns the localized title'
do
Gitlab
::
I18n
.
with_locale
(
:ru
)
do
expect
(
subject
.
first
[
:title
]).
to
eq
(
n_
(
'New Issue'
,
'New Issues'
,
2
))
end
end
context
'with subgroups'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
,
namespace:
create
(
:group
,
parent:
group
)))
}
...
...
@@ -80,6 +86,12 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageSummary d
expect
(
subject
.
second
[
:value
]).
to
eq
(
'2'
)
end
it
'returns the localized title'
do
Gitlab
::
I18n
.
with_locale
(
:ru
)
do
expect
(
subject
.
second
[
:title
]).
to
eq
(
n_
(
'Deploy'
,
'Deploys'
,
2
))
end
end
context
'with subgroups'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
...
...
lib/gitlab/cycle_analytics/summary/commit.rb
View file @
24b23ad8
...
...
@@ -5,7 +5,7 @@ module Gitlab
module
Summary
class
Commit
<
Base
def
title
n_
(
'Commit'
,
'Commits'
,
value
)
n_
(
'Commit'
,
'Commits'
,
value
.
to_i
)
end
def
value
...
...
lib/gitlab/cycle_analytics/summary/deploy.rb
View file @
24b23ad8
...
...
@@ -5,7 +5,7 @@ module Gitlab
module
Summary
class
Deploy
<
Base
def
title
n_
(
'Deploy'
,
'Deploys'
,
value
)
n_
(
'Deploy'
,
'Deploys'
,
value
.
to_i
)
end
def
value
...
...
lib/gitlab/cycle_analytics/summary/issue.rb
View file @
24b23ad8
...
...
@@ -12,7 +12,7 @@ module Gitlab
end
def
title
n_
(
'New Issue'
,
'New Issues'
,
value
)
n_
(
'New Issue'
,
'New Issues'
,
value
.
to_i
)
end
def
value
...
...
lib/gitlab/cycle_analytics/summary/value.rb
View file @
24b23ad8
...
...
@@ -15,6 +15,14 @@ module Gitlab
end
class
None
<
self
def
raw_value
0
end
def
to_i
raw_value
end
def
to_s
'-'
end
...
...
@@ -28,6 +36,10 @@ module Gitlab
def
to_s
value
.
zero?
?
'0'
:
value
.
to_s
end
def
to_i
raw_value
end
end
class
PrettyNumeric
<
Numeric
...
...
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
View file @
24b23ad8
...
...
@@ -14,19 +14,29 @@ describe Gitlab::CycleAnalytics::StageSummary do
let
(
:stage_summary
)
{
described_class
.
new
(
project
,
options
).
data
}
describe
"#new_issues"
do
subject
{
stage_summary
.
first
[
:value
]
}
subject
{
stage_summary
.
first
}
it
"finds the number of issues created after the 'from date'"
do
context
'when from date is given'
do
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
end
expect
(
subject
).
to
eq
(
'1'
)
it
"finds the number of issues created after the 'from date'"
do
expect
(
subject
[
:value
]).
to
eq
(
'1'
)
end
it
'returns the localized title'
do
Gitlab
::
I18n
.
with_locale
(
:ru
)
do
expect
(
subject
[
:title
]).
to
eq
(
n_
(
'New Issue'
,
'New Issues'
,
1
))
end
end
end
it
"doesn't find issues from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
))
}
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
context
'when `to` parameter is given'
do
...
...
@@ -38,38 +48,48 @@ describe Gitlab::CycleAnalytics::StageSummary do
it
"doesn't find any record"
do
options
[
:to
]
=
Time
.
now
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
it
"finds records created between `from` and `to` range"
do
options
[
:from
]
=
10
.
days
.
ago
options
[
:to
]
=
10
.
days
.
from_now
expect
(
subject
).
to
eq
(
'2'
)
expect
(
subject
[
:value
]
).
to
eq
(
'2'
)
end
end
end
describe
"#commits"
do
subject
{
stage_summary
.
second
[
:value
]
}
subject
{
stage_summary
.
second
}
it
"finds the number of commits created after the 'from date'"
do
context
'when from date is given'
do
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create_commit
(
"Test message"
,
project
,
user
,
'master'
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create_commit
(
"Test message"
,
project
,
user
,
'master'
)
}
end
expect
(
subject
).
to
eq
(
'1'
)
it
"finds the number of commits created after the 'from date'"
do
expect
(
subject
[
:value
]).
to
eq
(
'1'
)
end
it
'returns the localized title'
do
Gitlab
::
I18n
.
with_locale
(
:ru
)
do
expect
(
subject
[
:title
]).
to
eq
(
n_
(
'Commit'
,
'Commits'
,
1
))
end
end
end
it
"doesn't find commits from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create_commit
(
"Test message"
,
create
(
:project
,
:repository
),
user
,
'master'
)
}
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
it
"finds a large (> 100) number of commits if present"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create_commit
(
"Test message"
,
project
,
user
,
'master'
,
count:
100
)
}
expect
(
subject
).
to
eq
(
'100'
)
expect
(
subject
[
:value
]
).
to
eq
(
'100'
)
end
context
'when `to` parameter is given'
do
...
...
@@ -81,14 +101,14 @@ describe Gitlab::CycleAnalytics::StageSummary do
it
"doesn't find any record"
do
options
[
:to
]
=
Time
.
now
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
it
"finds records created between `from` and `to` range"
do
options
[
:from
]
=
10
.
days
.
ago
options
[
:to
]
=
10
.
days
.
from_now
expect
(
subject
).
to
eq
(
'2'
)
expect
(
subject
[
:value
]
).
to
eq
(
'2'
)
end
end
...
...
@@ -112,13 +132,23 @@ describe Gitlab::CycleAnalytics::StageSummary do
end
describe
"#deploys"
do
subject
{
stage_summary
.
third
[
:value
]
}
subject
{
stage_summary
.
third
}
it
"finds the number of deploys made created after the 'from date'"
do
context
'when from date is given'
do
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
end
expect
(
subject
).
to
eq
(
'1'
)
it
"finds the number of deploys made created after the 'from date'"
do
expect
(
subject
[
:value
]).
to
eq
(
'1'
)
end
it
'returns the localized title'
do
Gitlab
::
I18n
.
with_locale
(
:ru
)
do
expect
(
subject
[
:title
]).
to
eq
(
n_
(
'Deploy'
,
'Deploys'
,
1
))
end
end
end
it
"doesn't find commits from other projects"
do
...
...
@@ -126,7 +156,7 @@ describe Gitlab::CycleAnalytics::StageSummary do
create
(
:deployment
,
:success
,
project:
create
(
:project
,
:repository
))
end
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
context
'when `to` parameter is given'
do
...
...
@@ -138,14 +168,14 @@ describe Gitlab::CycleAnalytics::StageSummary do
it
"doesn't find any record"
do
options
[
:to
]
=
Time
.
now
expect
(
subject
).
to
eq
(
'-'
)
expect
(
subject
[
:value
]
).
to
eq
(
'-'
)
end
it
"finds records created between `from` and `to` range"
do
options
[
:from
]
=
10
.
days
.
ago
options
[
:to
]
=
10
.
days
.
from_now
expect
(
subject
).
to
eq
(
'2'
)
expect
(
subject
[
:value
]
).
to
eq
(
'2'
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment