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

Adds Logic to Map Actual Values to Reported Term #1264

Merged
merged 8 commits into from
Oct 12, 2017
Merged
Changes from 1 commit
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
Next Next commit
Adds Logic to Map Actual Values to Recorded Term
Jacob Wentz committed Oct 4, 2017
commit 458d138b5920002ae22571930d9027a440c82a6f
7 changes: 4 additions & 3 deletions src/components/agency/AgencyChartDetails.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import pluralize from 'pluralize'
import PropTypes from 'prop-types'
import React from 'react'
import generateId from '../../util/id'
import mapActualToRecorded from '../../util/termResolver'

import Term from '../Term'
import { formatNum as fmt } from '../../util/formats'
@@ -36,7 +37,7 @@ const AgencyChartDetails = ({
const comp = actual.count > actualLastYr.count ? 'increased' : 'decreased'
compSentence = (
<span>
Reported {noun} {highlight(comp)} from the previous year.
Recorded {noun} {highlight(comp)} from the previous year.
</span>
)
}
@@ -47,7 +48,7 @@ const AgencyChartDetails = ({
<p className="m0" style={{ maxWidth: 400 }}>
In <span id="selected-year-text">{highlight(year)}</span>, there{' '}
{pluralize('were', actual.count)} {highlight(fmt(actual.count))}{' '}
actual {pluralize(noun, actual.count)} of {crimeDisplay}. There{' '}
recorded {pluralize(noun, actual.count)} of {crimeDisplay}. There{' '}
{pluralize('were', cleared.count)} {highlight(fmt(cleared.count))}{' '}
cleared {crimeDisplay} {pluralize(noun, cleared.count)}. Crimes are
not necessarily cleared in the year they occur. {compSentence}
@@ -88,7 +89,7 @@ const AgencyChartDetails = ({
style={{ width: 8, height: 8, backgroundColor: colors(k) }}
/>
<Term id={k} size="sm">
{startCase(k)}
{startCase(mapActualToRecorded(k))}
</Term>
</td>
<td className="pt1 line-height-4 align-bottom right-align">
9 changes: 9 additions & 0 deletions src/util/termResolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

export const mapActualToRecorded = (str ) => {
if(str == 'actual'){
return 'recorded'
}
return str;
}

export default mapActualToRecorded