Skip to content

Commit

Permalink
Merge pull request #523 from onaio/issue-508-namibia-irs-bugs
Browse files Browse the repository at this point in the history
Issue 508 namibia irs bugs
  • Loading branch information
moshthepitt authored Oct 14, 2019
2 parents 8c35698 + 946aa8c commit d533586
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/containers/pages/IRS/JurisdictionsReport/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ export const NamibiaColumns = [
Header: 'Refusals',
columns: [
{
Cell: (cell: CellInfo) => getIRSThresholdAdherenceIndicator(cell, null),
Header: 'Following first visit',
accessor: 'refusalsfirst',
className: 'centered',
className: 'indicator centered',
id: 'refusalsfirst',
},
{
Cell: (cell: CellInfo) => getIRSThresholdAdherenceIndicator(cell, null),
Header: 'Following mop-up',
accessor: 'refusalsmopup',
className: 'centered',
className: 'indicator centered',
id: 'refusalsmopup',
},
],
Expand All @@ -84,15 +86,17 @@ export const NamibiaColumns = [
Header: 'Locked',
columns: [
{
Cell: (cell: CellInfo) => getIRSThresholdAdherenceIndicator(cell, null),
Header: 'Following first visit',
accessor: 'lockedfirst',
className: 'centered',
className: 'indicator centered',
id: 'lockedfirst',
},
{
Cell: (cell: CellInfo) => getIRSThresholdAdherenceIndicator(cell, null),
Header: 'Following mop-up',
accessor: 'lockedmopup',
className: 'centered',
className: 'indicator centered',
id: 'lockedmopup',
},
],
Expand Down
9 changes: 5 additions & 4 deletions src/helpers/indicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,15 @@ export function getThresholdAdherenceIndicator(cell: CellInfo, configId: string)

/** Renders an indicator Cell based on cell.value and threshold configs
* @param {CellInfo} cell - the ReactTable.Cell being rendered in an indicator drilldown table
* @param {string} configId - the key vause used to get the custom reporting configs
* @param {IndicatorThresholds | null} thresholds - the indicator thresholds
* @returns {React.ReactElement} - the ReactTable.Cell element to be rendered for the indicator
*/
export function getIRSThresholdAdherenceIndicator(cell: CellInfo) {
export function getIRSThresholdAdherenceIndicator(
cell: CellInfo,
thresholds: IndicatorThresholds | null = indicatorThresholdsNA
) {
// determine if cell.value is a number
const isNumber = !Number.isNaN(Number(cell.value));
// get thresholds config from settings
const thresholds: IndicatorThresholds | null = indicatorThresholdsNA;
// determine cell background color
const cellColor = thresholds ? getThresholdColor(cell, thresholds) : WHITE;

Expand Down

0 comments on commit d533586

Please sign in to comment.