Skip to content

Commit 4f36b6c

Browse files
oops, zero is falsy
1 parent 1bd10df commit 4f36b6c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/airqualityci/clkinfo.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,27 @@
5959
checkAQI(() => this.emit("redraw"));
6060
let aqi = data[config.rows[id].url]
6161
let txt = "";
62+
let aqius = (aqi && typeof(aqi.aqius) == "number") ? aqi.aqius : "...";
63+
let temp = (aqi && typeof(aqi.temp) == "number") ? aqi.temp : "...";
6264
switch ( config.rows[id].mode) {
6365
case 2:
64-
txt = ((aqi && aqi.aqius) || "...") + " " + ((aqi && aqi.temp) || "...") + "°";
66+
txt = aqius + " " + temp + "°";
6567
break;
6668
case 3:
67-
txt = row.name + " " + ((aqi && aqi.aqius) || "...");
69+
txt = row.name + " " + aqius;
6870
break;
6971
case 4:
70-
txt = row.name + " " + ((aqi && aqi.aqius) || "...") + " " + ((aqi && aqi.temp) || "...") + "°";
72+
txt = row.name + " " + aqius + " " + temp + "°";
7173
break;
7274
case 5:
7375
txt = row.name;
7476
break;
7577
default:
76-
txt = ((aqi && aqi.aqius) || "...");
78+
txt = aqius;
7779
}
7880
return {
7981
text: txt,
80-
short: ((aqi && aqi.aqius) || "..."),
82+
short: aqius,
8183
img: atob("GBiBAAA4AAB8AAd+AA++QB/d8D/t8D/p+DvqcBUPsA7vgB9fwA7vgAXvgAH/AAHwgAD3wAbfwA9/wA+/gA/fAA/OAA/gAAfAAAAAAA==")
8284
};
8385
}

0 commit comments

Comments
 (0)