Use the average number of test failure bugs instead of the total

The total is bogus because when we sum bugs from e.g. a week, we might be summing
the same bugs multiple times (while we should instead unite the sets of bugs, if we
had their IDs).
This commit is contained in:
Marco Castelluccio 2021-03-29 10:10:43 +02:00
Родитель e22e1981a7
Коммит cf500d49d5
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1673,12 +1673,18 @@ export async function renderTestFailureStatsChart(chartEl) {
)[0] )[0]
); );
const days = new Set();
const summaryData = await getSummaryData( const summaryData = await getSummaryData(
allTestStatsDays, allTestStatsDays,
getOption("grouping"), getOption("grouping"),
minDate, minDate,
(counterObj, testStatsDay) => { (counterObj, testStatsDay) => {
counterObj.bugs += testStatsDay[1].bugs; counterObj.bugs += testStatsDay[1].bugs;
if (!days.has(testStatsDay[0])) {
counterObj.days += 1;
days.add(testStatsDay[0]);
}
}, },
null, null,
(testStatsDay) => testStatsDay[0] (testStatsDay) => testStatsDay[0]
@ -1688,7 +1694,7 @@ export async function renderTestFailureStatsChart(chartEl) {
const bugs = []; const bugs = [];
for (const date in summaryData) { for (const date in summaryData) {
categories.push(date); categories.push(date);
bugs.push(summaryData[date].bugs); bugs.push(Math.ceil(summaryData[date].bugs / summaryData[date].days));
} }
renderChart( renderChart(
@ -1700,7 +1706,7 @@ export async function renderTestFailureStatsChart(chartEl) {
}, },
], ],
categories, categories,
"Evolution of the number of test failure bugs (total in the time period)", "Evolution of the number of active test failure bugs (average in the time period)",
"# of bugs" "# of bugs"
); );
} }