Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring, sorting, and enhancing progress report #1059

Merged
merged 11 commits into from
Jul 18, 2020
Prev Previous commit
Next Next commit
Report chapter contributor statistics
  • Loading branch information
ibnesayeed committed Jul 18, 2020
commit 7585a9a7b79a7d900a383915699c126433454aab
18 changes: 14 additions & 4 deletions .github/workflows/progress-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
const totalTrackedTasks = trackedTasks.length
core.info(`Tracking progress of ${totalTrackedTasks} tasks across chapters`)

const stats = nums => {
const calcStats = nums => {
if (!nums.length) {
return [0, 0, 0, 0, 0]
}
Expand All @@ -81,8 +81,8 @@ jobs:
nums.reduce((a,b) => a + b, 0),
Math.min(...nums),
Math.max(...nums),
nums.reduce((a,b) => a + b, 0) / nums.length,
nums.length % 2 ? nums[half] : (nums[half - 1] + nums[half]) / 2.0
(nums.reduce((a,b) => a + b, 0) / nums.length).toFixed(2),
(nums.length % 2 ? nums[half] : (nums[half - 1] + nums[half]) / 2.0).toFixed(2)
]
}

Expand Down Expand Up @@ -180,6 +180,11 @@ jobs:
return
}

const teamStats = {}
Object.keys(teamMembers).forEach(t => {
teamStats[t] = calcStats(chapters.map(c => (c.team[t] || []).length))
})

chapters.sort((a, b) => a.number.localeCompare(b.number, undefined, {numeric: true}))

chapters.forEach(c => {
Expand All @@ -195,6 +200,11 @@ jobs:
`:--------|:------|:----:${'|:-:'.repeat(totalTrackedTasks)}`
].concat(chapters.map(formatRow)).join('\n')

const stats = [
'Contributor Stats | Total | Min | Max | Mean | Median',
':-----------------|------:|----:|----:|-----:|------:'
].concat(Object.entries(teamStats).map(([k, v]) => `${k} | ${v.join(' | ')}`)).join('\n')

const teams = Object.entries(teamMembers).map(([k, v]) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With ~100 contributors, I think this section would get too unwieldy, and it's also not necessary to "@" notify each contributor.

I still like the idea of showing some aggregate stats. Could we do something like this instead?

Contributor stats

  Authors Reviewers Analysts
Total 30 45 20
Min 1 1 0
Max 3 9 2
Median 2 3 1
Average 2.5 5 1.1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With ~100 contributors, I think this section would get too unwieldy

I thought about it, but I decided to add it anyway because there is one piece of information that is not readily available anywhere, "in how many chapters a specific member is involved in and in what ways?", which I think is an important thing to know to properly distribute workload.

and it's also not necessary to "@" notify each contributor.

That's a very good point, I will certainly remove auto-mention feature.

I still like the idea of showing some aggregate stats. Could we do something like this instead?

Summarized statistical table is a great idea, but we can perhaps do it in a separate iteration (due to time constraints at my end).

Copy link
Contributor Author

@ibnesayeed ibnesayeed Jul 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rviscomi I think I have taken care of the issue of getting too unwieldy by hiding the list under a "details" element, so it will be there, but won't bother.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than making the contributors a <details> element could you not make each sub-team the <details> element? So can always see the team counts but can expand for names in a team.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than making the contributors a <details> element could you not make each sub-team the <details> element? So can always see the team counts but can expand for names in a team.

We can do it, but I think the current approach is more friendly in some ways (I am open to be convinced otherwise):

  • It is a compromise between clicking vs. scrolling, and right now individual contributor usernames are not in a separate line as bullet points, so I do not thing there will be too much scrolling (perhaps we will have a better idea of how much space it takes once it is merged here and reports are generated).
  • Currently, contributors report is composed as "h3" headings for each team name followed by a paragraph of comma separated usernames, which is independent of how it is finally placed in the report, i.e., only at the very end we decide to place it in a "details" container (which can be something else too), but if we decide it otherwise, "details" and "summary" elements will be engraved during the iteration over the data.

It may also depend on how the information is used often, a specific role at a time or a specific person (across rolls) at a time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rviscomi I have added stats table as well. Please have a look at tunetheweb#73 for an example.

return `### ${k} (${Object.keys(v).length})\n\n${Object.entries(v).sort().map(([m, c]) => `<span title="Chapters: ${c.join(', ')}">${m} (${c.length})</span>`).join(', ')}`
}).join('\n\n')
Expand All @@ -203,7 +213,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: trackerIssueNumber,
body: progressContent.replace(/<!-- REPORT START -->[\s\S]*<!-- REPORT END -->/, `<!-- REPORT START -->\n${report}\n\n<details><summary>Contributors</summary>\n\n${teams}\n</details>\n<!-- REPORT END -->`)
body: progressContent.replace(/<!-- REPORT START -->[\s\S]*<!-- REPORT END -->/, `<!-- REPORT START -->\n${report}\n\n${stats}\n\n<details><summary>Contributors</summary>\n\n${teams}\n</details>\n<!-- REPORT END -->`)
})

core.info(`Updated report in issue #${trackerIssueNumber} with ${chapters.length} chapters`)