11 Commits
0.0.8 ... 0.1.0

Author SHA1 Message Date
5cfba1c068 favicon
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-30 15:52:49 +01:00
09a670727f favicon
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-30 15:50:39 +01:00
f4a4597223 start pipeline, 2 2024-01-30 15:49:37 +01:00
70815f0172 start pipeline 2024-01-30 15:49:06 +01:00
e4e8e19466 small cahnges
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
2024-01-30 15:33:54 +01:00
2228f0cfb5 db fix 2024-01-30 15:29:46 +01:00
24fb1c2941 libpq, 3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-01-30 15:00:51 +01:00
cc3a6381d5 libpq 2024-01-30 14:59:46 +01:00
938562b9d8 requirements, 3
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-01-30 14:53:47 +01:00
103d60764b requirements, 2 2024-01-30 14:53:06 +01:00
8a446b8a8d requirements 2024-01-30 14:52:32 +01:00
8 changed files with 46 additions and 11 deletions

View File

@ -7,9 +7,12 @@ COPY start.sh ${APP_DIR}/
WORKDIR ${APP_DIR}
RUN pip install -r requirements.txt
RUN \
apk add --no-cache build-base libpq-dev && \
pip install -r requirements.txt
EXPOSE 8080
CMD "./start.sh"

View File

@ -28,7 +28,7 @@ def calculate_nutrition(food, weight):
with conn.cursor() as cursor:
# Abfrage der Nährwertdaten aus der Datenbank
cursor.execute('SELECT kcal, EW, Fett, KH, BST, CA FROM nutrition_table WHERE name = ?', (food,))
cursor.execute('SELECT kcal, EW, Fett, KH, BST, CA FROM nutrition_table WHERE name = %s', (food,))
result = cursor.fetchone()
@ -115,8 +115,9 @@ def add_nutrition():
try:
conn = psycopg2.connect()
with conn.cursor() as cursor:
cursor.execute("INSERT INTO nutrition_table (name, kcal, ew, fett, kh, bst, ca) VALUES (?, ?, ?, ?, ?, ?, ?)",
(food, kcal, ew, fett, kh, bst, ca))
cursor.execute("INSERT INTO nutrition_table (name, kcal, ew, fett, kh, bst, ca) VALUES (%s, %s, %s, %s, %s, %s, %s)",
(food, kcal, ew, fett, kh, bst, ca))
return redirect(url_for('nutrition'))
finally:

View File

@ -13,6 +13,8 @@ itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.4
packaging==23.2
psycopg==3.1.17
psycopg2==2.9.9
pycparser==2.21
requests==2.31.0
typing_extensions==4.9.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -121,3 +121,27 @@ tr:hover:not(.selected) {
padding: 20px;
margin: 20px 0;
}
#nutrition-input-table {
width: 100%; /* Tabelle nimmt die volle Breite ein */
border-collapse: collapse; /* Entfernt doppelte Ränder */
}
#nutrition-input-table th, #nutrition-input-table td {
border: 1px solid #ddd; /* Fügt Ränder hinzu */
padding: 8px; /* Fügt Innenabstand hinzu */
text-align: left; /* Ausrichtung des Textes */
}
#nutrition-input-table input {
width: 100%; /* Eingabefelder nehmen die volle Breite der Zelle ein */
box-sizing: border-box; /* Box-Modell für die Breitenberechnung */
}
@media screen and (max-width: 600px) {
#nutrition-input-table {
display: block;
overflow-x: auto; /* Ermöglicht horizontales Scrollen auf kleinen Bildschirmen */
}
}

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8">
<title>Nährwertberechnungs-App</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
<link rel="shortcut icon" href="../static/images/favicon.ico">
<script>

View File

@ -4,6 +4,8 @@
<meta charset="UTF-8">
<title>Neue Lebensmittel hinzufügen</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
<link rel="shortcut icon" href="../static/images/favicon.ico">
<script>
function updateSubmitButtonState() {
const inputs = document.querySelectorAll('#nutrition-form input');
@ -62,13 +64,13 @@
<th>CA</th>
</tr>
<tr>
<td><input type="text" name="food" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="kcal" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="ew" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="fett" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="kh" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="bst" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="ca" pattern="\d+(\.\d{1,2})?" oninput="updateSubmitButtonState()"></td>
<td><input type="text" name="food" placeholder="Lebensmittel" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="kcal" pattern="\d+(\.\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="ew" pattern="\d+(\.\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="fett" pattern="\d+(\.\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="kh" pattern="\d+(\.\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="bst" pattern="\d+(\.\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
<td><input <input type="text" name="ca" pattern="\d+(\.\d{1,2})?" placeholder="mg" oninput="updateSubmitButtonState()"></td>
</tr>
</table>
<button type="submit" id="submit-button" disabled>Hinzufügen</button>

View File

@ -2,3 +2,5 @@
gunicorn 'Run:app' --bind 0.0.0.0:8080 --log-level=info --workers=4