add null check to gender

This commit is contained in:
prisar
2023-07-20 17:53:59 +05:30
parent 4dc6bab0a9
commit 1c68c7f23d
2 changed files with 12 additions and 8 deletions

2
.gitignore vendored
View File

@@ -23,3 +23,5 @@ yarn-debug.log*
yarn-error.log*
.firebase
src/components/testData.json

View File

@@ -59,10 +59,10 @@ function App() {
const patient = document.data();
patients.push(patient);
const { gender } = patient;
if (gender.toLowerCase() === 'male') {
if (gender?.toLowerCase() === 'male') {
maleCount++;
}
if (gender.toLowerCase() === 'female') {
if (gender?.toLowerCase() === 'female') {
femaleCount++;
}
});
@@ -139,12 +139,14 @@ function App() {
<Card title={"Disease"} counter={diseases} backgroundColor={'rgb(249, 195, 195)'} />
</div>
<div className='last-update'>
Updated At: {Date(lastUpdate).toLocaleString()}
</div>
<div className='footer'>
<div className='last-update'>
Updated At: {Date(lastUpdate).toLocaleString()}
</div>
<div className='developer'>
Developed by <img className="dev-logo" src={require('./smi-logo-120x120.webp')} /> ShanMukha
<div className='developer'>
Developed by <img className="dev-logo" src={require('./smi-logo-120x120.webp')} /> ShanMukha
</div>
</div>
</div>
</div>