Skip to content

Commit a77fa18

Browse files
Update local_forecasts.js
1 parent c1bb02c commit a77fa18

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

local_forecasts.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,15 +1159,19 @@ function readApiBaker(options = {}) {
11591159
}
11601160
if (forecast.pm25 !== undefined) {
11611161
masterData.master_pm25.push(forecast.pm25);
1162-
if (forecast.pm25_aqi !== undefined) {
1162+
if (forecast.pm25_aqi !== undefined && forecast.pm25_aqi !== null) {
11631163
masterData.master_pm25_aqi.push(forecast.pm25_aqi);
1164-
} else {
1164+
} else if (forecast.pm25 !== undefined && forecast.pm25 !== null) {
11651165
masterData.master_pm25_aqi.push(calculateAqiForPm25(forecast.pm25));
1166+
} else {
1167+
masterData.master_pm25_aqi.push('N/A');
11661168
}
1167-
if (forecast.pm25_conc_cnn !== undefined) {
1169+
if (forecast.pm25_conc_cnn !== undefined && forecast.pm25_conc_cnn !== null) {
11681170
masterData.master_pm25_conc_cnn.push(forecast.pm25_conc_cnn);
1169-
} else {
1171+
} else if (forecast.pm25 !== undefined && forecast.pm25 !== null) {
11701172
masterData.master_pm25_conc_cnn.push(forecast.pm25);
1173+
} else {
1174+
masterData.master_pm25_conc_cnn.push('N/A');
11711175
}
11721176
}
11731177

0 commit comments

Comments
 (0)