Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ITKY2121tp7
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
malmente
ITKY2121tp7
Commits
95e5e7bc
Commit
95e5e7bc
authored
11 months ago
by
Oskari Lahtinen
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tyopaja.py
+4
-2
4 additions, 2 deletions
tyopaja.py
with
4 additions
and
2 deletions
tyopaja.py
+
4
−
2
View file @
95e5e7bc
...
...
@@ -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-2
6
%
'"
).
fetchall
()
paivanruuat
=
cur
.
execute
(
"
SELECT id, ruoka FROM ateria WHERE paiva LIKE
'
2024-02-2
8
%
'"
).
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!
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment