Skip to content

Commit

Permalink
Clarify that a preprint can have multiple requests
Browse files Browse the repository at this point in the history
Refs #26
  • Loading branch information
thewilkybarkid committed Jul 2, 2024
1 parent d368eb4 commit f310508
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const languageColor = Plot.scale({
},
})

const requestsGroupedByPreprint = d3.group(requestsSelected, request => request.preprint)

const requestsByField = requestsSelected
.flatMap(({ fields, ...request }) => fields.map(field => ({ ...request, field })))
.filter(request => (chosenDomain ? openAlexFields[request.field].domain === chosenDomain : true))
Expand All @@ -101,6 +103,9 @@ const requestsBySubfield = requestsSelected
<div class="card">
<h2>${chosenField ? `${openAlexFields[chosenField].name} requests` : chosenDomain ? `${openAlexDomains[chosenDomain]} requests` : 'Requests'}</h2>
<span class="big">${requestsSelected.length.toLocaleString("en-US")}</span>
${requestsGroupedByPreprint.size !== requestsSelected.length ? html`
<span class="muted">for ${requestsGroupedByPreprint.size.toLocaleString("en-US")} preprints</span>
` : ''}
${chosenField ? html`
<div>${d3.format(".1%")(requestsSelected.length / requests.filter(d => d.domains.includes(chosenDomain)).length)} of all ${openAlexDomains[chosenDomain]} requests</div>
` : ''}
Expand Down

0 comments on commit f310508

Please sign in to comment.