Skip to content

Commit 1952cf6

Browse files
authored
Merge pull request #29 from ianvizarra/dev
Use `updated` attribute from country api instead of `all`
2 parents 3698ef3 + e1c51bd commit 1952cf6

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

app.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ app.get('/:country', async (req, res, next) => {
5353
const userAgent = req.headers['user-agent'],
5454
countryData = req.params.country,
5555
api = await axios.get(`${apiBaseURL}/countries/${countryData}`),
56-
all = await axios.get(`${apiBaseURL}/all`),
57-
u = all.data,
5856
d = api.data;
5957
if (util.isCommandline(userAgent)) {
6058
await res.send(covid19.covid19countrytracker(
6159
d.country, d.cases, d.todayCases,
6260
d.deaths, d.todayDeaths, d.recovered,
6361
d.active, d.critical, d.casesPerOneMillion,
64-
u.updated
62+
d.updated
6563
));
6664
return null;
6765
}
@@ -73,15 +71,13 @@ app.get(['/plain/:country','/cmd/:country','/basic/:country'], async (req, res,
7371
const userAgent = req.headers['user-agent'],
7472
countryData = req.params.country,
7573
api = await axios.get(`${apiBaseURL}/countries/${countryData}`),
76-
all = await axios.get(`${apiBaseURL}/all`),
77-
u = all.data,
7874
d = api.data;
7975
if (util.isCommandline(userAgent)) {
8076
await res.send(covid19.plaincountrytracker(
8177
d.country, d.cases, d.todayCases,
8278
d.deaths, d.todayDeaths, d.recovered,
8379
d.active, d.critical, d.casesPerOneMillion,
84-
u.updated
80+
d.updated
8581
));
8682
return null;
8783
}
@@ -93,21 +89,18 @@ app.get('/history/:country/:chartType(cases|deaths)?', async (req, res, next) =>
9389
const userAgent = req.headers['user-agent'],
9490
countryData = req.params.country,
9591
chartType = req.params.chartType || 'cases',
96-
9792
summary = await axios.get(`${apiBaseURL}/countries/${countryData}`),
9893
history = await axios.get(`${apiBaseURL}/v2/historical/${summary.data.country}`),
99-
all = await axios.get(`${apiBaseURL}/all`),
10094
s = summary.data,
10195
h = history.data;
102-
u = all.data;
10396

10497
if (util.isCommandline(userAgent)) {
10598
await res.send(
10699
covid19.historyCountryTracker(
107100
s.country, s.cases, s.todayCases,
108101
s.deaths, s.todayDeaths, s.recovered,
109102
s.active, s.critical, s.casesPerOneMillion,
110-
u.updated, h, chartType
103+
s.updated, h, chartType
111104
)
112105
);
113106
return null;

0 commit comments

Comments
 (0)