diff options
author | Joel Kronqvist <joelkronqvist@proton.me> | 2023-06-21 12:30:58 +0300 |
---|---|---|
committer | Joel Kronqvist <joelkronqvist@proton.me> | 2023-06-21 12:30:58 +0300 |
commit | 9760c6242572f6ed17890b84ec3d14fa414b7579 (patch) | |
tree | 710049705e74f5ecbc2b79ffa21eabe637f2b5ec /food.js | |
parent | 5f74d40fa736745651514853afdca3ed44e5ae74 (diff) | |
download | LYLLRuoka-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.js | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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], |