diff options
author | JoelHMikael <joel.h.kronqvist@gmail.com> | 2022-01-13 09:36:07 +0200 |
---|---|---|
committer | JoelHMikael <joel.h.kronqvist@gmail.com> | 2022-01-13 09:36:07 +0200 |
commit | 1a1b117cc9eae2cc2ecfb3695bebe21daf08741b (patch) | |
tree | 1c4173b746e9b8af4bc0bd6e7ded34ad3f365100 /server.js | |
parent | 21e79dcc1eabebfd661a2fd38681348ae9428c4e (diff) | |
download | LYLLRuoka-1a1b117cc9eae2cc2ecfb3695bebe21daf08741b.tar.gz LYLLRuoka-1a1b117cc9eae2cc2ecfb3695bebe21daf08741b.zip |
Made the parsing more inclusive
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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", ""); |