From 9760c6242572f6ed17890b84ec3d14fa414b7579 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Wed, 21 Jun 2023 12:30:58 +0300 Subject: Some patches made in production :facepalm: At least some of them have to do with running updations timely? --- food.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'food.js') diff --git a/food.js b/food.js index 7a9691d..5744090 100644 --- a/food.js +++ b/food.js @@ -4,7 +4,7 @@ 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>/gm const foods = data.matchAll(foodRegex); for(const food of foods) { @@ -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