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
3416c705
Commit
3416c705
authored
Apr 17, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add warning when burndown is not accurate
parent
d789295a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
6 deletions
+41
-6
app/models/burndown.rb
app/models/burndown.rb
+3
-2
app/views/shared/milestones/_burndown.html.haml
app/views/shared/milestones/_burndown.html.haml
+5
-0
spec/features/milestones/show_spec.rb
spec/features/milestones/show_spec.rb
+31
-2
spec/models/burndown_spec.rb
spec/models/burndown_spec.rb
+2
-2
No files found.
app/models/burndown.rb
View file @
3416c705
class
Burndown
attr_accessor
:start_date
,
:due_date
,
:end_date
,
:issues_count
,
:issues_weight
,
:has_data
attr_reader
:start_date
,
:due_date
,
:end_date
,
:issues_count
,
:issues_weight
,
:accurate
alias_method
:accurate?
,
:accurate
def
initialize
(
milestone
)
@milestone
=
milestone
...
...
@@ -7,7 +8,7 @@ class Burndown
@due_date
=
@milestone
.
due_date
@end_date
=
@milestone
.
due_date
@end_date
=
Date
.
today
if
@end_date
.
present?
&&
@end_date
>
Date
.
today
@
has_data
=
issues_with_closed_at
.
pluck
(
:closed_at
).
compact
.
an
y?
@
accurate
=
issues_with_closed_at
.
where
(
closed_at:
nil
).
empt
y?
@issues_count
,
@issues_weight
=
milestone
.
issues
.
reorder
(
nil
).
pluck
(
'COUNT(*), COALESCE(SUM(weight), 0)'
).
first
end
...
...
app/views/shared/milestones/_burndown.html.haml
View file @
3416c705
...
...
@@ -7,6 +7,11 @@
=
page_specific_javascript_bundle_tag
(
'common_d3'
)
=
page_specific_javascript_bundle_tag
(
'burndown_chart'
)
-
unless
burndown
.
accurate?
#no-data-warning
.settings-message.prepend-top-20
Some issues can't be shown in the burndown chart, as they were closed before GitLab 9.1 update.
=
link_to
"More information."
,
help_page_path
(
'workflow/milestones'
)
-
if
can_generate_chart
.burndown-header
%h3
...
...
spec/features/milestones/show_spec.rb
View file @
3416c705
...
...
@@ -3,12 +3,12 @@ require 'rails_helper'
describe
'Milestone show'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
,
start_date:
Date
.
today
,
due_date:
7
.
days
.
from_now
)
}
let
(
:labels
)
{
create_list
(
:label
,
2
,
project:
project
)
}
let
(
:issue_params
)
{
{
project:
project
,
assignee:
user
,
author:
user
,
milestone:
milestone
,
labels:
labels
}
}
before
do
project
.
add_user
(
user
,
:developer
)
project
.
add_user
(
user
,
:developer
)
login_as
(
user
)
end
...
...
@@ -23,4 +23,33 @@ describe 'Milestone show', feature: true do
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control_count
)
end
context
'burndown'
do
before
{
issue_params
.
delete
(
:labels
)
}
context
'when closed issues does not have closed_at value'
do
it
'shows warning'
do
create
(
:issue
,
issue_params
)
issue
=
create
(
:issue
,
issue_params
)
issue
.
update
(
state:
'closed'
)
issue
.
update
(
closed_at:
nil
)
visit_milestone
expect
(
page
).
to
have_selector
(
'#no-data-warning'
)
end
end
context
'data is accurate'
do
it
'does not show warning'
do
create
(
:issue
,
issue_params
)
issue
=
create
(
:issue
,
issue_params
)
issue
.
close
visit_milestone
expect
(
page
).
not_to
have_selector
(
'#no-data-warning'
)
end
end
end
end
spec/models/burndown_spec.rb
View file @
3416c705
...
...
@@ -60,7 +60,7 @@ describe Burndown, models: true do
it
"it sets attribute has_data to true"
do
burndown
=
described_class
.
new
(
milestone
)
expect
(
burndown
.
has_data
).
to
be_truthy
expect
(
burndown
.
accurate?
).
to
be_truthy
end
context
"when closed and reopened issues does not have closed_at"
do
...
...
@@ -79,7 +79,7 @@ describe Burndown, models: true do
it
"it sets attribute has_data to false"
do
burndown
=
described_class
.
new
(
milestone
)
expect
(
burndown
.
has_data
).
to
be_falsy
expect
(
burndown
.
accurate?
).
to
be_falsy
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