Commit ab1fe3ce authored by Wei-Meng Lee's avatar Wei-Meng Lee

Fix burndown negative count edge case

parent 5439bfe4
...@@ -53,7 +53,7 @@ export default class BurndownChartData { ...@@ -53,7 +53,7 @@ export default class BurndownChartData {
// weight count on an given date. To mitigate this, we reset the current // 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's counters to 0 and carry forward the negative count to a future
// date until the total is positive again. // date until the total is positive again.
if (openIssuesCount < 0 || openIssuesWeight < 0) { if (openIssuesCount <= 0 || openIssuesWeight <= 0) {
carriedIssuesCount = openIssuesCount; carriedIssuesCount = openIssuesCount;
carriedIssuesWeight = openIssuesWeight; carriedIssuesWeight = openIssuesWeight;
......
---
title: Fix burndown negative count edge case
merge_request: 18053
author:
type: fixed
...@@ -93,6 +93,7 @@ describe('BurndownChartData', () => { ...@@ -93,6 +93,7 @@ describe('BurndownChartData', () => {
{ 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-01T00:00:00.000Z', weight: 2, action: 'closed' }, { 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-01T00:00:00.000Z', weight: 2, action: 'closed' },
{ created_at: '2017-03-02T00:00:00.000Z', weight: 2, action: 'created' },
); );
}); });
...@@ -100,7 +101,7 @@ describe('BurndownChartData', () => { ...@@ -100,7 +101,7 @@ describe('BurndownChartData', () => {
expect(burndownChartData.generate()).toEqual([ expect(burndownChartData.generate()).toEqual([
['2017-03-01', 0, 0], ['2017-03-01', 0, 0],
['2017-03-02', 0, 0], ['2017-03-02', 0, 0],
['2017-03-03', 1, 2], ['2017-03-03', 2, 4],
]); ]);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment