Skip to content
Snippets Groups Projects
Commit 95e5e7bc authored by Oskari Lahtinen's avatar Oskari Lahtinen :speech_balloon:
Browse files

korjattu bugi indeksien kanssa, myös muut päivät kuin maanantai toimii nyt

parent 25f3b0a6
Branches main
No related tags found
No related merge requests found
......@@ -15,12 +15,14 @@ def haetykkaykset(id, cur):
# haetaan tietoja
pvm = '2024-02-26'
paivanruuat = cur.execute("SELECT id, ruoka FROM ateria WHERE paiva LIKE '2024-02-26%'").fetchall()
paivanruuat = cur.execute("SELECT id, ruoka FROM ateria WHERE paiva LIKE '2024-02-28%'").fetchall()
while True:
valid_ids = []
for ruokatuple in paivanruuat:
# data saadaan änniköissä (engl. tuple)
id = ruokatuple[0]
valid_ids.append(id)
ruoka = ruokatuple[1]
#print(id)
print(f"[{str(id)}] {ruoka}")
......@@ -33,7 +35,7 @@ while True:
tulos = int(tulos)
except ValueError:
tulos = -1
if(tulos > 0 and tulos < len(paivanruuat)+1):
if(tulos in valid_ids):
tykkaa(tulos, cur)
else:
print("syöte ei ollut validi!")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment