aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-20 19:46:26 +0300
committerJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-20 19:46:26 +0300
commita760ac4091d400b2ae1f461550eed5004b444844 (patch)
treeeb4f36d8c7754d23a4851ad7bbeb0ec2c0f8e164
parentc28fe49a7a303ef0440ccffd830e4949a1f2381f (diff)
downloadLYLLRuoka-a760ac4091d400b2ae1f461550eed5004b444844.tar.gz
LYLLRuoka-a760ac4091d400b2ae1f461550eed5004b444844.zip
Made vegetarian food empty when not found. Had become visible in commit 'Bug fixes & started setup.sh'
-rw-r--r--dbparse.js2
-rw-r--r--server.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/dbparse.js b/dbparse.js
index eddfdc8..a65add0 100644
--- a/dbparse.js
+++ b/dbparse.js
@@ -180,7 +180,7 @@ async function getRandomIndex(day, DB, depth=0)
let indexes = await DB.execute("SELECT course, teacher, class FROM shifts WHERE day = ? ORDER BY RAND() LIMIT 1", [day]);
- indexes = Object.values(indexes[0] || [null, null, null]); /// ERROR HERE!!!
+ indexes = Object.values(indexes[0] || [null, null, null]);
let start = randInt(0, indexes.length);
for (let test = 0; test < 3; test++)
{
diff --git a/server.js b/server.js
index c180b71..5b51eee 100644
--- a/server.js
+++ b/server.js
@@ -281,12 +281,12 @@ async function buildMain(args)
res["food-header"] = `Kouluruoka ${weekdays[day]}`;
res["food"] = "Päivän ruoka puuttuu tietokannasta.";
}
- if (food[1] !== undefined) {
+ if (vege[0] !== 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."
+ res["vege-header"] = "";
+ res["vege"] = "";
}
data_string = build_replace(data_string, res);