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
c57a4d9e
Commit
c57a4d9e
authored
Oct 03, 2019
by
Wei-Meng Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account for more edge cases
Also adjust code so we're handling these edge cases the right way
parent
ab1fe3ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
18 deletions
+72
-18
ee/app/assets/javascripts/burndown_chart/burndown_chart_data.js
.../assets/javascripts/burndown_chart/burndown_chart_data.js
+4
-4
ee/spec/frontend/burndown_chart/burndown_chart_data_spec.js
ee/spec/frontend/burndown_chart/burndown_chart_data_spec.js
+68
-14
No files found.
ee/app/assets/javascripts/burndown_chart/burndown_chart_data.js
View file @
c57a4d9e
...
...
@@ -53,13 +53,13 @@ export default class BurndownChartData {
// weight count on an given date. To mitigate this, we reset the current
// date's counters to 0 and carry forward the negative count to a future
// date until the total is positive again.
if
(
openIssuesCount
<=
0
||
openIssuesWeight
<=
0
)
{
carriedIssuesCount
=
openIssuesCount
;
carriedIssuesWeight
=
openIssuesWeight
;
if
(
openIssuesCount
+
carriedIssuesCount
<
0
||
openIssuesWeight
+
carriedIssuesWeight
<
0
)
{
carriedIssuesCount
+
=
openIssuesCount
;
carriedIssuesWeight
+
=
openIssuesWeight
;
openIssuesCount
=
0
;
openIssuesWeight
=
0
;
}
else
if
(
carriedIssuesCount
<
0
||
carriedIssuesWeight
<
0
)
{
}
else
{
openIssuesCount
+=
carriedIssuesCount
;
openIssuesWeight
+=
carriedIssuesWeight
;
...
...
ee/spec/frontend/burndown_chart/burndown_chart_data_spec.js
View file @
c57a4d9e
...
...
@@ -87,23 +87,77 @@ describe('BurndownChartData', () => {
});
});
describe
(
'
when first two days of milestone have negative issue count
'
,
()
=>
{
describe
(
'
when days in milestone have negative counts
'
,
()
=>
{
describe
(
'
and the first two days have a negative count
'
,
()
=>
{
beforeAll
(()
=>
{
milestoneEvents
.
length
=
0
;
milestoneEvents
.
push
(
{
created_at
:
'
2017-03-01T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-01T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-02T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
);
});
it
(
'
generates an array where the first two days counts are zero
'
,
()
=>
{
expect
(
burndownChartData
.
generate
()).
toEqual
([
[
'
2017-03-01
'
,
0
,
0
],
[
'
2017-03-02
'
,
0
,
0
],
[
'
2017-03-03
'
,
1
,
2
],
]);
});
});
describe
(
'
and the middle day has a negative count
'
,
()
=>
{
// This scenario is unlikely to occur as this implies there are more
// closed issues than total issues, but we account for it anyway as a
// potential edge case.
beforeAll
(()
=>
{
milestoneEvents
.
length
=
0
;
milestoneEvents
.
push
(
{
created_at
:
'
2017-03-01T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-02T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-02T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
);
});
it
(
'
generates an array where the middle day count is zero
'
,
()
=>
{
expect
(
burndownChartData
.
generate
()).
toEqual
([
[
'
2017-03-01
'
,
1
,
2
],
[
'
2017-03-02
'
,
0
,
0
],
[
'
2017-03-03
'
,
1
,
2
],
]);
});
});
describe
(
'
and the last day has a negative count
'
,
()
=>
{
// This scenario is unlikely to occur as this implies there are more
// closed issues than total issues, but we account for it anyway as a
// potential edge case.
beforeAll
(()
=>
{
milestoneEvents
.
length
=
0
;
milestoneEvents
.
push
(
{
created_at
:
'
2017-03-01T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-02T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-02T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
created
'
},
{
created_at
:
'
2017-03-03T00:00:00.000Z
'
,
weight
:
2
,
action
:
'
closed
'
},
);
});
it
(
'
sets first two dates data to 0 and carries forward negative total to the third day
'
,
()
=>
{
it
(
'
generates an array where all counts are zero
'
,
()
=>
{
expect
(
burndownChartData
.
generate
()).
toEqual
([
[
'
2017-03-01
'
,
0
,
0
],
[
'
2017-03-02
'
,
0
,
0
],
[
'
2017-03-03
'
,
2
,
4
],
[
'
2017-03-03
'
,
0
,
0
],
]);
});
});
});
});
});
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