Skip to content

Commit 4bac9eb

Browse files
GalacticCodeGambitPrussianBaronCopilotCopilot
authored
Blatt18 (#179)
* Python Black Formatierung umgesetzt * Fix typo in findRecipes function parameter name * Add import statement for Database module in RecipeSUCUK.py * Upgrade actions/checkout from v4 to v5 in CI configuration files * Correct directory name in README and update email variable for clarity * Improve grammar and punctuation in README description * Refactor CSS class names for consistency and clarity (#171) * Refactor CSS class names for consistency and clarity * Refactor CSS variables for improved readability and consistency * Remove unnecessary stylelint directive for cleaner CSS * Refactor variable names for consistency in recipe filtering functions * Fix css * Upgrade CodeQL action versions from v3 to v4 in CI configuration * Pin npm dependencies to specific versions for stability and update versions (#174) * Pin npm dependencies to specific versions for stability * Remove duplicate npm dependencies for cleaner package management * added the format Ingridients function to Ingridient.yp and removed it from RecipeSUCUK and RecipeNameFinder * fixed some additional error in naming * Pin bcrypt, python-jose, and python-multipart to specific versions for consistency * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add popup class aliases for legacy profile dialogs --------- Co-authored-by: PrussianBaron <goebelsamuel@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 9368004 commit 4bac9eb

9 files changed

Lines changed: 32 additions & 36 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![ci.yml](https://github.com/GalacticCodeGambit/LazyCook/actions/workflows/ci.yml/badge.svg)](https://github.com/GalacticCodeGambit/LazyCook/actions/workflows/ci.yml)
33
[![lint.yml](https://github.com/GalacticCodeGambit/LazyCook/actions/workflows/lint.yml/badge.svg)](https://github.com/GalacticCodeGambit/LazyCook/actions/workflows/lint.yml)
44

5-
LazyCook soll eine Webanwendung sein. Die es ermöglichen, seine vorhandenen Zutaten einzutragen, und darauf soll LazyCook dir mögliche Rezepte/Gerichte vorschlagen, die du aus diesen Zutaten gemacht werden können.
5+
LazyCook soll eine Webanwendung sein, die es ermöglicht, vorhandene Zutaten einzutragen. Darauf basierend soll LazyCook mögliche Rezepte/Gerichte vorschlagen, die du aus diesen Zutaten machen kannst.
66
## Features
77
- [x] [#23](https://github.com/GalacticCodeGambit/LazyCook/issues/23) Zutaten hinzufügen können
88
- [x] [#24](https://github.com/GalacticCodeGambit/LazyCook/issues/24) Zutaten entfernen können

project/backend/Database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def addIngredient(name: str, amountType: str) -> int:
266266
return cur.lastrowid
267267

268268

269-
def getIngridientByName(name: str):
269+
def getIngredientByName(name: str):
270270
with getDB() as con:
271271
cur = con.cursor()
272272
cur.execute(

project/backend/EmailService.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,3 @@ def sendPasswordResetEmail(to_email: str, name: str, resetLink: str) -> None:
7272
except Exception as e:
7373
print(f"E-Mail Fehler: {e}")
7474
raise
75-

project/backend/Ingredient.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import List, Dict, Any
2-
from Database import addIngredient
2+
from Database import addIngredient, getAllIngredientsForRecipe
33

44

55
class Ingredient:
@@ -35,3 +35,12 @@ def saveInDB(self):
3535
return False
3636
else:
3737
return True
38+
39+
def formatIngredients(id: int) -> list[Ingredient]:
40+
IngredientsRaw = getAllIngredientsForRecipe(id)
41+
Ingredients = []
42+
for IngredientRaw in IngredientsRaw:
43+
Ingredients.append(
44+
Ingredient(IngredientRaw["name"], IngredientRaw["amount"])
45+
)
46+
return Ingredients

project/backend/Recipe.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from Ingredient import Ingredient
2-
from Database import addIngredientToRecipe, addRecipe, getIngridientByName
2+
from Database import addIngredientToRecipe, addRecipe, getIngredientByName
33

44

55
class Recipe:
@@ -15,12 +15,12 @@ def __init__(self, name: str, ingredients: list[Ingredient], description: str):
1515

1616
def saveInDB(self) -> bool:
1717
rid = addRecipe(self.__name, self.__description, None)
18-
for ingridient in self.__ingredients:
19-
result = getIngridientByName(ingridient.getName())
18+
for ingredient in self.__ingredients:
19+
result = getIngredientByName(ingredient.getName())
2020
if not result:
2121
return False
22-
zid = result['id']
23-
addIngredientToRecipe(zid, rid, ingridient.getAmount())
22+
zid = result["id"]
23+
addIngredientToRecipe(zid, rid, ingredient.getAmount())
2424
return True
2525

2626
def getName(self) -> str:

project/backend/RecipeSUCUK.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SUCUK = Search for Uncomplicated Cooking and User-friendly Kitchen recipes
22
from Ingredient import Ingredient
33
from Recipe import Recipe
4-
from Database import getAllRecipes, getAllIngredientsForRecipe
4+
from Database import getAllRecipes
55

66

77
def findRecipes(ingredients: list[Ingredient]) -> list[Recipe]:
@@ -33,21 +33,13 @@ def __initRecipes() -> list[Recipe]:
3333
for recipeRaw in recipesRaw:
3434
recipe = Recipe(
3535
recipeRaw["name"],
36-
__formatIngredients(recipeRaw["id"]),
36+
Ingredient.formatIngredients(recipeRaw["id"]),
3737
recipeRaw["description"],
3838
)
3939
recipes.append(recipe)
4040
return recipes
4141

4242

43-
def __formatIngredients(id: int) -> list[Ingredient]:
44-
IngredientsRaw = getAllIngredientsForRecipe(id)
45-
Ingredients = []
46-
for IngredientRaw in IngredientsRaw:
47-
Ingredients.append(Ingredient(IngredientRaw["name"], IngredientRaw["amount"]))
48-
return Ingredients
49-
50-
5143
if __name__ == "__main__":
5244
ini = []
5345
ini.append(Ingredient("Linguine", 10))
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from Database import getAllRecipes, getAllIngredientsForRecipe
1+
from Database import getAllRecipes
22
from Ingredient import Ingredient
33
from Recipe import Recipe
44

@@ -12,16 +12,8 @@ def getMatchingRecipeNames(searchTerm: str) -> list[Recipe]:
1212
matchingRecipes.append(
1313
Recipe(
1414
recipe["name"],
15-
__formatIngredients(recipe["id"]),
15+
Ingredient.formatIngredients(recipe["id"]),
1616
recipe["description"],
1717
)
1818
)
1919
return matchingRecipes
20-
21-
22-
def __formatIngredients(id: int) -> list[Ingredient]:
23-
IngredientsRaw = getAllIngredientsForRecipe(id)
24-
Ingredients = []
25-
for IngredientRaw in IngredientsRaw:
26-
Ingredients.append(Ingredient(IngredientRaw["name"], IngredientRaw["amount"]))
27-
return Ingredients

project/backend/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
fastapi[standard]==0.121.1
33
uvicorn[standard]==0.38.0
44
gunicorn==23.0.0
5-
bcrypt
6-
python-jose[cryptography]
7-
python-multipart
5+
bcrypt==5.0.0
6+
python-jose[cryptography]==3.5.0
7+
python-multipart==0.0.27
88
pytest==9.0.3
99
pytest-cov==6.0.0

project/frontend/app/recipeFinder/style.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
gap: 20px;
8282
}
8383

84-
.popup-title {
84+
.popup-title,
85+
.popup__title {
8586
font-size: 20px;
8687
font-weight: 600;
8788
color: #111;
@@ -90,16 +91,19 @@
9091
margin: 0;
9192
}
9293

93-
.popup-fields {
94+
.popup-fields,
95+
.popup__fields {
9496
display: flex;
9597
gap: 10px;
9698
}
9799

98-
.popup-fields-stacked {
100+
.popup-fields-stacked,
101+
.popup__fields--stacked {
99102
flex-direction: column;
100103
}
101104

102-
.popup-input {
105+
.popup-input,
106+
.popup__input {
103107
flex: 1;
104108
padding: 10px 12px;
105109
border-radius: 6px;

0 commit comments

Comments
 (0)