aboutsummaryrefslogtreecommitdiff
path: root/food.js
diff options
context:
space:
mode:
authorJoel Kronqvist <joelkronqvist@proton.me>2023-06-21 12:30:58 +0300
committerJoel Kronqvist <joelkronqvist@proton.me>2023-06-21 12:30:58 +0300
commit9760c6242572f6ed17890b84ec3d14fa414b7579 (patch)
tree710049705e74f5ecbc2b79ffa21eabe637f2b5ec /food.js
parent5f74d40fa736745651514853afdca3ed44e5ae74 (diff)
downloadLYLLRuoka-9760c6242572f6ed17890b84ec3d14fa414b7579.tar.gz
LYLLRuoka-9760c6242572f6ed17890b84ec3d14fa414b7579.zip
Some patches made in production :facepalm:
At least some of them have to do with running updations timely?
Diffstat (limited to 'food.js')
-rw-r--r--food.js6
1 files changed, 3 insertions, 3 deletions
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 = /<title>(\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],