Skip to content

Commit

Permalink
Merge pull request #284 from futurice/fix-handling-low-response-data
Browse files Browse the repository at this point in the history
Fix handling low response data
  • Loading branch information
Doniee authored Apr 29, 2020
2 parents af446fb + 3162548 commit b3867d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/frontend/main/ModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,35 @@ const ModalContent = ({ content, hide }: ModalContentProps) => {
<H2>{content.city}</H2>
</ModalHeader>
<H3>
Vastauksia yhteensä: {formattedData.responsesTotal} ({formattedData.percentageOfPopulation} % väkiluvusta)
Vastauksia yhteensä: {formattedData.responsesTotal}{' '}
{formattedData.percentageOfPopulation != null
? `(${formattedData.percentageOfPopulation} % väkiluvusta)`
: null}
</H3>
<Description>{formattedData.responsesTotal !== '< 25' ? 'Verrattuna kunnan väkilukuun' : null}</Description>
{formattedData.responsesTotal !== '< 25' ? <Description>Verrattuna kunnan väkilukuun</Description> : null}
<Symptoms>
<table>
<tbody>
<tr>
<td>{formattedData.suspicionTotal}</td>
<td>{formattedData.suspicionPercentage} %</td>
{formattedData.suspicionPercentage != null ? <td>{formattedData.suspicionPercentage} %</td> : null}
<th scope="row">Epäilys koronavirus&shy;tartunnasta</th>
</tr>
<tr>
<td>{formattedData.coughTotal}</td>
<td>{formattedData.coughPercentage} %</td>
{formattedData.coughPercentage != null ? <td>{formattedData.coughPercentage} %</td> : null}
<th scope="row">Yskää</th>
</tr>
<tr>
<td>{formattedData.feverTotal}</td>
<td>{formattedData.feverPercentage} %</td>
{formattedData.feverPercentage != null ? <td>{formattedData.feverPercentage} %</td> : null}
<th scope="row">Kuumetta</th>
</tr>
<tr>
<td>{formattedData.breathingDifficultiesTotal}</td>
<td>{formattedData.breathingDifficultiesPercentage} %</td>
{formattedData.breathingDifficultiesPercentage != null ? (
<td>{formattedData.breathingDifficultiesPercentage} %</td>
) : null}
<th scope="row">Vaikeuksia hengittää</th>
</tr>
</tbody>
Expand Down
19 changes: 14 additions & 5 deletions src/frontend/main/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ const TableView = ({ data, cities, isEmbed }: TableViewProps) => {
<CityHeadingContainer>
<CityHeading>{item.city}</CityHeading>
<BoldText>Vastauksia yhteensä {formattedData.responsesTotal}</BoldText>
<ItalicText>{formattedData.percentageOfPopulation} % väkiluvusta</ItalicText>

{formattedData.percentageOfPopulation != null ? (
<ItalicText>{formattedData.percentageOfPopulation} % väkiluvusta</ItalicText>
) : null}
</CityHeadingContainer>
<Table>
<TableHead>
Expand All @@ -170,22 +173,28 @@ const TableView = ({ data, cities, isEmbed }: TableViewProps) => {
<tr>
<th scope="row">Epäilys koronavirus&shy;tartunnasta</th>
<td>{formattedData.suspicionTotal}</td>
<td>{formattedData.suspicionPercentage} %</td>
<td>
{formattedData.suspicionPercentage != null ? `${formattedData.suspicionPercentage} %` : '-'}
</td>
</tr>
<tr>
<th scope="row">Yskää</th>
<td>{formattedData.coughTotal}</td>
<td>{formattedData.coughPercentage} %</td>
<td>{formattedData.coughPercentage != null ? `${formattedData.coughPercentage} %` : '-'}</td>
</tr>
<tr>
<th scope="row">Kuumetta</th>
<td>{formattedData.feverTotal}</td>
<td>{formattedData.feverPercentage} %</td>
<td>{formattedData.feverPercentage != null ? `${formattedData.feverPercentage} %` : '-'}</td>
</tr>
<tr>
<th scope="row">Vaikeuksia hengittää</th>
<td>{formattedData.breathingDifficultiesTotal}</td>
<td>{formattedData.breathingDifficultiesPercentage} %</td>
<td>
{formattedData.breathingDifficultiesPercentage != null
? `${formattedData.breathingDifficultiesPercentage} %`
: '-'}
</td>
</tr>
</tbody>
</Table>
Expand Down

0 comments on commit b3867d3

Please sign in to comment.