diff --git a/src/users.md b/src/users.md index 9f17ca8..22aac68 100644 --- a/src/users.md +++ b/src/users.md @@ -71,6 +71,15 @@ const reviewsInTimePeriod = chosenYear ? reviews.filter(review => review.createdAt.getUTCFullYear() === chosenYear) : reviews +const userReviews = reviewsInTimePeriod.flatMap(({ authors, ...review }) => + authors.map(author => ({ ...review, ...author })), +) +const reviewsByAuthor = d3.rollup( + userReviews, + d => d.length, + d => `${d.authorType}:${d.author}`, +) + const careerStageColor = Plot.scale({ color: { type: 'categorical', @@ -85,14 +94,31 @@ const careerStageColor = Plot.scale({

PREreviewers ${chosenYear ? ` joining in ${chosenYear}` : ''}

${usersInTimePeriod.length.toLocaleString("en-US")} +
+

PREreviewers with PREreviews published ${chosenYear ? ` in ${chosenYear}` : ''}

+ + + + + + + + + + + + + + + + + +
At least 1${d3.sum(reviewsByAuthor, d => d[1] >= 1 ? 1 : 0).toLocaleString('en-US')}
Only 1${d3.sum(reviewsByAuthor, d => d[1] === 1 ? 1 : 0).toLocaleString('en-US')}
More than 1${d3.sum(reviewsByAuthor, d => d[1] > 1 ? 1 : 0).toLocaleString('en-US')}
More than 3${d3.sum(reviewsByAuthor, d => d[1] > 3 ? 1 : 0).toLocaleString('en-US')}
+
```js function mostAuthored({ width } = {}) { - const userReviews = reviewsInTimePeriod.flatMap(({ authors, ...review }) => - authors.map(author => ({ ...review, ...author })), - ) - return Plot.plot({ title: `PREreviewers by number of PREreviews${chosenYear ? ` published in ${chosenYear}` : ''}`, width: Math.max(width, 600), @@ -228,3 +254,16 @@ function usersByLocation() { ${usersByLocation()} + +