From 1a1b117cc9eae2cc2ecfb3695bebe21daf08741b Mon Sep 17 00:00:00 2001 From: JoelHMikael Date: Thu, 13 Jan 2022 09:36:07 +0200 Subject: Made the parsing more inclusive --- server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server.js') 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", ""); -- cgit v1.2.3