From 5e2547349618d459fb9594be23dc11c5a314fbaf Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 4 May 2021 14:21:14 -0700 Subject: [PATCH] Status Chart: Avoid emitting consecutive zeros (#1895) * npm update. * weekly_table.js: 2021-04-30 update. * Adjust PR Age max and stepSize. * Update usernames_contributors.txt. * Avoid emitting consecutive zeros. * chart.js 3.2.1. --- gather_stats.js | 79 +++++++++++++++++++++----------------- index.html | 12 +++--- package-lock.json | 28 +++++++------- usernames_contributors.txt | 1 + weekly_table.js | 1 + 5 files changed, 66 insertions(+), 55 deletions(-) diff --git a/gather_stats.js b/gather_stats.js index bcb4cc2c8c..8fa7441b41 100644 --- a/gather_stats.js +++ b/gather_stats.js @@ -327,7 +327,13 @@ function write_generated_file(filename, table_str) { fs.writeFileSync(filename, str); } +function should_emit_data_point(rows, i, key) { + return rows[i - 1]?.[key] > 0 || rows[i][key] > 0 || rows[i + 1]?.[key] > 0; +} + function write_daily_table(script_start, all_prs, all_issues) { + const rows = []; + const progress_bar = new cliProgress.SingleBar( { format: '{bar} {percentage}% | ETA: {eta}s | {value}/{total} days analyzed', @@ -339,10 +345,7 @@ function write_daily_table(script_start, all_prs, all_issues) { ); try { - let str = 'const daily_table = [\n'; - const begin = DateTime.fromISO('2019-09-05' + 'T23:00:00'); - const begin_cxx23 = DateTime.fromISO('2020-11-10'); progress_bar.start(Math.ceil(script_start.diff(begin).as('days')), 0); @@ -390,45 +393,51 @@ function write_daily_table(script_start, all_prs, all_issues) { } } - const avg_age = num_pr === 0 ? 0 : combined_pr_age.as('days') / num_pr; - const avg_wait = num_pr === 0 ? 0 : combined_pr_wait.as('days') / num_pr; - const sum_age = combined_pr_age.as('months'); - const sum_wait = combined_pr_wait.as('months'); - - const cells = [ - `date: '${when.toISODate()}'`, - `merged: ${Number.parseFloat(num_merged).toFixed(2)}`, - `pr: ${num_pr}`, - `cxx20: ${num_cxx20}`, - ]; + rows.push({ + date: when, + merged: num_merged, + pr: num_pr, + cxx20: num_cxx20, + cxx23: num_cxx23, + lwg: num_lwg, + issue: num_issue, + bug: num_bug, + avg_age: num_pr === 0 ? 0 : combined_pr_age.as('days') / num_pr, + avg_wait: num_pr === 0 ? 0 : combined_pr_wait.as('days') / num_pr, + sum_age: combined_pr_age.as('months'), + sum_wait: combined_pr_wait.as('months'), + }); - if (when >= begin_cxx23) { - cells.push(`cxx23: ${num_cxx23}`); - } + progress_bar.increment(); + } + } finally { + progress_bar.stop(); + } - cells.push( - `lwg: ${num_lwg}`, - `issue: ${num_issue}`, - `bug: ${num_bug}`, - `avg_age: ${Number.parseFloat(avg_age).toFixed(2)}`, - `avg_wait: ${Number.parseFloat(avg_wait).toFixed(2)}`, - `sum_age: ${Number.parseFloat(sum_age).toFixed(2)}`, - `sum_wait: ${Number.parseFloat(sum_wait).toFixed(2)}`, - '},\n' - ); + let str = 'const daily_table = [\n'; - str += ' { '; - str += cells.join(', '); + for (let i = 0; i < rows.length; ++i) { + const row = rows[i]; + str += ' { '; + str += `date: '${row.date.toISODate()}', `; + str += `merged: ${Number.parseFloat(row.merged).toFixed(2)}, `; - progress_bar.increment(); + for (const key of ['pr', 'cxx20', 'cxx23', 'lwg', 'issue', 'bug']) { + if (should_emit_data_point(rows, i, key)) { + str += `${key}: ${row[key]}, `; + } } - str += '];\n'; - - write_generated_file('./daily_table.js', str); - } finally { - progress_bar.stop(); + str += `avg_age: ${Number.parseFloat(row.avg_age).toFixed(2)}, `; + str += `avg_wait: ${Number.parseFloat(row.avg_wait).toFixed(2)}, `; + str += `sum_age: ${Number.parseFloat(row.sum_age).toFixed(2)}, `; + str += `sum_wait: ${Number.parseFloat(row.sum_wait).toFixed(2)}, `; + str += '},\n'; } + + str += '];\n'; + + write_generated_file('./daily_table.js', str); } function write_monthly_table(script_start, all_prs) { diff --git a/index.html b/index.html index f1bd04b460..a50ea4c5ed 100644 --- a/index.html +++ b/index.html @@ -26,8 +26,8 @@ font-weight: bold; } - + @@ -372,9 +372,9 @@ text: 'Average Age, Average Wait (days)', }, min: 0, - max: 150, + max: 180, ticks: { - stepSize: 10, + stepSize: 20, }, }, rightAxis: { @@ -386,9 +386,9 @@ text: 'Combined Age, Combined Wait (PR-months)', }, min: 0, - max: 150, + max: 180, ticks: { - stepSize: 10, + stepSize: 20, }, }, }, diff --git a/package-lock.json b/package-lock.json index 340d14b6cc..ad46655587 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,9 +37,9 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.2.0.tgz", - "integrity": "sha512-V2vFYuawjpP5KUb8CPYsq20bXT4qnE8sH1QKpYqUlcNOntBiRr/VzGVvY0s+YXGgrVbFUVO4EI0VnHYSVBWfBg==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-7.0.0.tgz", + "integrity": "sha512-gV/8DJhAL/04zjTI95a7FhQwS6jlEE0W/7xeYAzuArD0KVAVWDLP2f3vi98hs3HLTczxXdRK/mF0tRoQPpolEw==" }, "node_modules/@octokit/request": { "version": "5.4.15", @@ -65,11 +65,11 @@ } }, "node_modules/@octokit/types": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.14.0.tgz", - "integrity": "sha512-43qHvDsPsKgNt4W4al3dyU6s2XZ7ZMsiiIw8rQcM9CyEo7g9W8/6m1W4xHuRqmEjTfG1U4qsE/E4Jftw1/Ak1g==", + "version": "6.14.2", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.14.2.tgz", + "integrity": "sha512-wiQtW9ZSy4OvgQ09iQOdyXYNN60GqjCL/UdMsepDr1Gr0QzpW6irIKbH3REuAHXAhxkEk9/F2a3Gcs1P6kW5jA==", "dependencies": { - "@octokit/openapi-types": "^6.2.0" + "@octokit/openapi-types": "^7.0.0" } }, "node_modules/ansi-regex": { @@ -328,9 +328,9 @@ } }, "@octokit/openapi-types": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.2.0.tgz", - "integrity": "sha512-V2vFYuawjpP5KUb8CPYsq20bXT4qnE8sH1QKpYqUlcNOntBiRr/VzGVvY0s+YXGgrVbFUVO4EI0VnHYSVBWfBg==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-7.0.0.tgz", + "integrity": "sha512-gV/8DJhAL/04zjTI95a7FhQwS6jlEE0W/7xeYAzuArD0KVAVWDLP2f3vi98hs3HLTczxXdRK/mF0tRoQPpolEw==" }, "@octokit/request": { "version": "5.4.15", @@ -356,11 +356,11 @@ } }, "@octokit/types": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.14.0.tgz", - "integrity": "sha512-43qHvDsPsKgNt4W4al3dyU6s2XZ7ZMsiiIw8rQcM9CyEo7g9W8/6m1W4xHuRqmEjTfG1U4qsE/E4Jftw1/Ak1g==", + "version": "6.14.2", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.14.2.tgz", + "integrity": "sha512-wiQtW9ZSy4OvgQ09iQOdyXYNN60GqjCL/UdMsepDr1Gr0QzpW6irIKbH3REuAHXAhxkEk9/F2a3Gcs1P6kW5jA==", "requires": { - "@octokit/openapi-types": "^6.2.0" + "@octokit/openapi-types": "^7.0.0" } }, "ansi-regex": { diff --git a/usernames_contributors.txt b/usernames_contributors.txt index 415a999b6b..85fb050bc4 100644 --- a/usernames_contributors.txt +++ b/usernames_contributors.txt @@ -1,6 +1,7 @@ # This is very far from an exhaustive list of contributors, and confers no special status. # It's simply a list of contributors who have submitted a PR review marked as CHANGES_REQUESTED. +2002Bishwajeet AdamBucior AlexGuteniev fsb4000 diff --git a/weekly_table.js b/weekly_table.js index 214f06ec5d..28b089be1a 100644 --- a/weekly_table.js +++ b/weekly_table.js @@ -204,4 +204,5 @@ const weekly_table = [ { date: '2021-04-09', vso: 163, libcxx: 579 }, { date: '2021-04-16', vso: 164, libcxx: 579 }, { date: '2021-04-23', vso: 173, libcxx: 594 }, + { date: '2021-04-30', vso: 173, libcxx: 594 }, ];