From 0f2d56eafd01b5e728f96cf327f1a3e881a21225 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Nov 2022 13:07:11 +0200 Subject: Hid vegetarian food when it is the same as the normal food. Added date logging to init.sh. --- food.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'food.js') diff --git a/food.js b/food.js index 7a9691d..8de8dcd 100644 --- a/food.js +++ b/food.js @@ -3,8 +3,8 @@ const open = require("./Functions/open.js"); const { weekdayToNumber } = require("./Functions/dateFuncs.js"); function* scrapeFood(data) -{ - const foodRegex = /(\w{2} (?:\d\d?\.){2}\d{4})<\/title><description><!\[CDATA\[(Lounas) ?:? ?(.*?)(Kasvislounas) ?:? ?(.*?)]]><\/description>/gm; +{ + const foodRegex = /<title>(\w{2} (?:\d\d?\.){2}\d{4})<\/title><description><!\[CDATA\[(Lounas) ?:? ?(.*?)<br>(Kasvislounas) ?:? ?(.*?)]]><\/description>/ const foods = data.matchAll(foodRegex); for(const food of foods) { -- cgit v1.2.3 From 5665f993de41b82ab24c4a546d442b18f0bda4d3 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist <work.joelkronqvist@gmail.com> Date: Mon, 14 Nov 2022 16:29:04 +0200 Subject: Introduced (ugly) fix for food overflows. For real, the server was down for A WHOLE DAY, just because a food next week was 1 CHARACTER MORE than 256 characters! --- food.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'food.js') diff --git a/food.js b/food.js index 8de8dcd..9a73404 100644 --- a/food.js +++ b/food.js @@ -31,14 +31,14 @@ async function buildFoods(DB) { for(const food of foods[week - 1]) { - foodInitOperations.push(DB.execute("INSERT INTO foods VALUES (?, ?, FALSE, ?, ?, ?)", [ + foodInitOperations.push(DB.execute("INSERT IGNORE INTO foods VALUES (?, ?, FALSE, ?, ?, ?)", [ week, food[0], food[2][0], food[1], food[2][1] ])); - foodInitOperations.push(DB.execute("INSERT INTO foods VALUES (?, ?, TRUE, ?, ?, ?)", [ + foodInitOperations.push(DB.execute("INSERT IGNORE INTO foods VALUES (?, ?, TRUE, ?, ?, ?)", [ week, food[0], food[3][0], -- cgit v1.2.3