aboutsummaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorJoelHMikael <joel.h.kronqvist@gmail.com>2022-01-13 09:36:07 +0200
committerJoelHMikael <joel.h.kronqvist@gmail.com>2022-01-13 09:36:07 +0200
commit1a1b117cc9eae2cc2ecfb3695bebe21daf08741b (patch)
tree1c4173b746e9b8af4bc0bd6e7ded34ad3f365100 /server.js
parent21e79dcc1eabebfd661a2fd38681348ae9428c4e (diff)
downloadLYLLRuoka-1a1b117cc9eae2cc2ecfb3695bebe21daf08741b.tar.gz
LYLLRuoka-1a1b117cc9eae2cc2ecfb3695bebe21daf08741b.zip
Made the parsing more inclusive
Diffstat (limited to 'server.js')
-rw-r--r--server.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/server.js b/server.js
index d92a8eb..3f78fb3 100644
--- a/server.js
+++ b/server.js
@@ -34,6 +34,7 @@ async function init()
// get the MySQL DB connection
const SQLDB = new SQL_DBS.Database(JSON.parse(dbcredentials));
+ buildDB(SQLDB, "./projectshifts.txt");
// get the food "database"
const foods = [foodsThisWeek, foodsNextWeek];
@@ -280,11 +281,11 @@ function build_replace(s, dict)
// Run this if you want to build the database from text files
-async function buildDB(DB)
+async function buildDB(SQLDB, shiftfile = "./shifts.txt", classfile = "./classes.txt")
{
let [shiftCont, classCont] = await Promise.all([
- openFile("./shifts.txt"),
- openFile("./classes.txt")
+ openFile(shiftfile),
+ openFile(classfile)
]);
shiftCont = shiftCont.toString("utf-8").replaceAll("\r", ""); // \r because of the \r\n newline on windows which creates problems
classCont = classCont.toString("utf-8").replaceAll("\r", "");