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

Fix map numbers #102

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/components/cap-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export class CapMap extends LitElement {
return mapping;
}

getFormattedNumber(number) {
return number.toLocaleString();
}

render() {
return html`
<div class="mapRegion">
Expand All @@ -166,42 +170,38 @@ export class CapMap extends LitElement {
: "State and Federal Totals"}
</h3>
<p class="infoBox__text">
${this.activeStats.caseCount}<br /><span
${this.getFormattedNumber(this.activeStats.caseCount)}<br /><span
class="infoBox__textDescriptor"
>Unique cases</span
>
</p>
<p class="infoBox__text">
${this.activeStats.reporterCount}<br /><span
class="infoBox__textDescriptor"
>Reporters</span
>
${this.getFormattedNumber(
this.activeStats.reporterCount,
)}<br /><span class="infoBox__textDescriptor">Reporters</span>
</p>
<p class="infoBox__text">
${this.activeStats.pageCount}<br /><span
${this.getFormattedNumber(this.activeStats.pageCount)}<br /><span
class="infoBox__textDescriptor"
>Pages scanned</span
>
</p>

<h3 class="infoBox__heading">Federal Totals</h3>
<p class="infoBox__text">
${nationalCaselawStats.total.caseCount}<br /><span
class="infoBox__textDescriptor"
>Unique cases</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.caseCount,
)}<br /><span class="infoBox__textDescriptor">Unique cases</span>
</p>
<p class="infoBox__text">
${nationalCaselawStats.total.reporterCount}<br /><span
class="infoBox__textDescriptor"
>Reporters</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.reporterCount,
)}<br /><span class="infoBox__textDescriptor">Reporters</span>
</p>
<p class="infoBox__text">
${nationalCaselawStats.total.pageCount}<br /><span
class="infoBox__textDescriptor"
>Pages scanned</span
>
${this.getFormattedNumber(
nationalCaselawStats.total.pageCount,
)}<br /><span class="infoBox__textDescriptor">Pages scanned</span>
</p>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/data/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export const mapAbbreviations = [
];

export const nationalCaselawStats = {
total: {
state: {
caseCount: 6930777,
reporterCount: 612,
pageCount: 36357668,
},
state: {
total: {
caseCount: 1842484,
reporterCount: 75,
pageCount: 10409741,
Expand Down
Loading