Community Leaderboard
Total numbers of package submissions and reviews by community members. By default this includes editors, with a toggle to filter out numbers from anybody who is or has been a member of the editorial team.
Red dots ● indicate statistical software packages/reviews.
leaderboard = {
const editorSet = new Set(
submissions.filter(d => d.ed === true).map(d => d.gh_handle)
);
const statsSet = new Set(
submissions.filter(d => d.stats === true).map(d => d.gh_handle)
);
return submissions
.filter(d => showEditors || !editorSet.has(d.gh_handle))
.filter(d => !showStats || statsSet.has(d.gh_handle))
.map(d => {
const pkgs = [].concat(d.pkgs || []);
const revs = [].concat(d.revs || []);
return {
handle: d.gh_handle,
author: pkgs.length,
reviewer: revs.length,
total: pkgs.length + revs.length,
pkgNums: pkgs,
revNums: revs,
stats: d.stats === true
};
})
.filter(d => d.total > 0)
.sort((a, b) => b.total - a.total || b.author - a.author)
.slice(0, nEntries);
}{
const base = "https://github.com/ropensci/software-review/issues/";
if (!selectedBar) return html`<em style="color:#888">Hover over a bar to see linked issues.</em>`;
const entry = leaderboard.find(d => d.handle === selectedBar.handle);
if (!entry) return html``;
const links = (nums) => [...nums].sort((a, b) => a - b).map(n =>
html`<a href="${base}${n}" target="_blank">#${n}</a>`
).reduce((acc, el, i) => i === 0 ? [el] : [...acc, ", ", el], []);
return html`<div style="margin-top:0.5em;line-height:2">
<strong>${entry.handle}</strong><br>
${entry.pkgNums.length ? html`<span><strong style="color:#4e79a7">Author</strong>: ${links(entry.pkgNums)}</span><br>` : ""}
${entry.revNums.length ? html`<span><strong style="color:#f28e2b">Reviewer</strong>: ${links(entry.revNums)}</span>` : ""}
</div>`;
}viewof selectedBar = Plot.plot({
marginLeft: 145,
width: 700,
height: leaderboard.length * 26 + 40,
x: {label: "Score (number of appearances)", grid: true},
y: {domain: leaderboard.map(d => d.handle), label: null, padding: 0.3, axis: null},
color: {
domain: ["author", "reviewer"],
range: ["#4e79a7", "#f28e2b"],
legend: true
},
marks: [
Plot.barX(leaderboardLong, Plot.stackX({
x: "count",
y: "handle",
fill: "role",
tip: true
})),
Plot.dot(leaderboard.filter(d => d.stats), {
x: 0,
y: "handle",
fill: "#e15759",
r: 4,
dx: -8
}),
Plot.text(leaderboard.filter(d => !d.stats), {
x: 0,
y: "handle",
text: "handle",
textAnchor: "end",
dx: -3
}),
Plot.text(leaderboard.filter(d => d.stats), {
x: 0,
y: "handle",
text: "handle",
textAnchor: "end",
dx: -15
})
]
})