Skip to content

Commit

Permalink
Measure #handbook PR open time (#23124)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric <[email protected]>
  • Loading branch information
Sampfluger88 and eashaw authored Oct 23, 2024
1 parent 64ce873 commit 95221e5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions website/scripts/get-bug-and-pr-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,22 +365,22 @@ module.exports = {
let averageDaysContributorPullRequestsAreOpenFor = Math.round(_.sum(daysSinceContributorPullRequestsWereOpened)/daysSinceContributorPullRequestsWereOpened.length);


// Compute CEO-dependent PR KPIs, which are slightly simpler.
// Compute Handbook PR KPIs, which are slightly simpler.
// FUTURE: Refactor this to be less messy.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
let ceoDependentOpenPrs = [];
ceoDependentOpenPrs = ceoDependentOpenPrs.concat(allPublicOpenPrs.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('~ceo')));
ceoDependentOpenPrs = ceoDependentOpenPrs.concat(allNonPublicOpenPrs.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('~ceo')));
let handbookOpenPrs = [];
handbookOpenPrs = handbookOpenPrs.concat(allPublicOpenPrs.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('#handbook')));
handbookOpenPrs = handbookOpenPrs.concat(allNonPublicOpenPrs.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('#handbook')));

let ceoDependentPrsMergedRecently = [];
ceoDependentPrsMergedRecently = ceoDependentPrsMergedRecently.concat(publicPrsMergedInThePastThreeWeeks.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('~ceo')));
ceoDependentPrsMergedRecently = ceoDependentPrsMergedRecently.concat(nonPublicPrsClosedInThePastThreeWeeks.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('~ceo')));
let handbookPrsMergedRecently = [];
handbookPrsMergedRecently = handbookPrsMergedRecently.concat(publicPrsMergedInThePastThreeWeeks.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('#handbook')));
handbookPrsMergedRecently = handbookPrsMergedRecently.concat(nonPublicPrsClosedInThePastThreeWeeks.filter((pr) => !pr.draft && _.pluck(pr.labels, 'name').includes('#handbook')));

let ceoDependentPrOpenTime = ceoDependentPrsMergedRecently.reduce((avgDaysOpen, pr)=>{
let handbookPrOpenTime = handbookPrsMergedRecently.reduce((avgDaysOpen, pr)=>{
let openedAt = new Date(pr.created_at).getTime();
let closedAt = new Date(pr.closed_at).getTime();
let daysOpen = Math.abs(closedAt - openedAt) / ONE_DAY_IN_MILLISECONDS;
avgDaysOpen = avgDaysOpen + (daysOpen / ceoDependentPrsMergedRecently.length);
avgDaysOpen = avgDaysOpen + (daysOpen / handbookPrsMergedRecently.length);
sails.log.verbose('Processing',pr.head.repo.name,':: #'+pr.number,'open '+daysOpen+' days', 'rolling avg now '+avgDaysOpen);
return avgDaysOpen;
}, 0);
Expand Down Expand Up @@ -451,15 +451,15 @@ module.exports = {
Number of issues with the "#g-mdm", "bug", and "customer-" labels opened in the past week: ${allBugsCreatedInPastWeekMobileDeviceManagementCustomerImpacting.length}
Number of issues with the "#g-emdm", "bug", and "~released bug" labels opened in the past week: ${allBugsCreatedInPastWeekMobileDeviceManagementReleased.length}
Number of issues with the "#g-mdm", "bug", and "~released bug" labels opened in the past week: ${allBugsCreatedInPastWeekMobileDeviceManagementReleased.length}
Number of issues with the "#g-mdm", "bug", and "~unreleased bug" labels opened in the past week: ${allBugsCreatedInPastWeekMobileDeviceManagementUnreleased.length}
Pull requests requiring CEO review
Handbook Pull requests
---------------------------------------
Number of open ~ceo pull requests in the fleetdm Github org: ${ceoDependentOpenPrs.length}
Number of open #handbook pull requests in the fleetdm Github org: ${handbookOpenPrs.length}
Average open time (~ceo PRs): ${Math.round(ceoDependentPrOpenTime*100)/100} days.
Average open time (#handbook PRs): ${Math.round(handbookPrOpenTime*100)/100} days.
`);

}
Expand Down

0 comments on commit 95221e5

Please sign in to comment.