diff options
author | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-10-15 20:05:32 +0300 |
---|---|---|
committer | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-10-15 20:05:32 +0300 |
commit | b2925ef2579050c484a552f2cd9c0ffed11fb1e9 (patch) | |
tree | cf7708162afe815ef855e8af5e9a1012d2587ff6 /server.js | |
parent | 98a7a9947828514372d873b88fcdcdf44a358dd3 (diff) | |
download | LYLLRuoka-b2925ef2579050c484a552f2cd9c0ffed11fb1e9.tar.gz LYLLRuoka-b2925ef2579050c484a552f2cd9c0ffed11fb1e9.zip |
Bug fixes & started setup.sh
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -35,7 +35,7 @@ async function init() ]); - // https options, you need to get a certificate in the file ../Certificate for the server to work + // https options, you need to get a certificate in the file ../Certificate for the server to work const httpsOpts = { key: httpsKey, cert: httpsCert @@ -264,10 +264,21 @@ async function buildMain(args) [week, day] ) ]); - res["food-header"] = `${food[0].header} ${food[0].datestring}`; - res["vege-header"] = vege[0].header; - res["food"] = food[0].food; - res["vege"] = vege[0].food; + + if (food[0] !== undefined) { + res["food-header"] = `${food[0].header} ${food[0].datestring}`; + res["food"] = food[0].food; + } else { + res["food-header"] = `Kouluruoka ${weekdays[day]}`; + res["food"] = "Päivän ruoka puuttuu tietokannasta."; + } + if (food[1] !== undefined) { + res["vege-header"] = vege[0].header; + res["vege"] = vege[0].food; + } else { + res["vege-header"] = `Kasvisruoka ${weekdays[day]}`; + res["vege"] = "Päivän kasvisruoka puuttuu tietokannasta." + } data_string = build_replace(data_string, res); |