Skip to content

Commit

Permalink
Tmp fix for API error and version bump
Browse files Browse the repository at this point in the history
Signed-off-by: sarthakpranesh <[email protected]>
  • Loading branch information
sarthakpranesh committed Aug 7, 2021
1 parent 6daf69d commit 130acc2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "3.2.0"
versionName "3.2.1"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Covid19",
"version": "3.2.0",
"version": "3.2.1",
"private": true,
"scripts": {
"android": "npx react-native run-android",
Expand Down
9 changes: 7 additions & 2 deletions src/API/DiseaseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ export const fetchTimelineData: (country: String) => Promise<TimelineData[]> = (
])
.then(([casesTimeline, vaccineTimeline]) => {
const dateKeys = Object.keys(casesTimeline.cases)
let lastRecovered = 0
const filteredData: TimelineData[] = dateKeys.map((date) => {
// temporary check as total recovery went 0 in latest data
// remove once APIs are fixed
lastRecovered = lastRecovered > casesTimeline.recovered[date] ? lastRecovered : casesTimeline.recovered[date]
const r: TimelineData = {
date: date,
active:
casesTimeline.cases[date] - (casesTimeline.recovered[date] + casesTimeline.deaths[date]),
casesTimeline.cases[date] - (lastRecovered + casesTimeline.deaths[date]),
vaccinated: vaccineTimeline[date] || 0,
total: casesTimeline.cases[date],
recovered: casesTimeline.recovered[date],
recovered: lastRecovered,
deaths: casesTimeline.deaths[date]
}
return r
})
console.log(filteredData[filteredData.length - 1])
resolve(filteredData)
})
.catch((err) => {
Expand Down

0 comments on commit 130acc2

Please sign in to comment.