Skip to content

Commit 923b181

Browse files
authored
Merge pull request #246 from ZeusWPI/free-choice
feat: ability to remove free choice from orders
2 parents 22e1240 + 1dbcda5 commit 923b181

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

app/hlds/parser.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def __init__(self, identifier, price):
3232
# pylint: disable=no-self-use
3333
class HldsSemanticActions:
3434
def location(self, ast) -> Location:
35+
attributes = {att["key"]: att["value"] for att in ast["attributes"]}
36+
3537
choices = {
3638
choice.id: choice for choice in filter_instance(Choice, ast["items_"])
3739
}
@@ -60,18 +62,19 @@ def location(self, ast) -> Location:
6062
option.price += dish.price
6163
dish.price = 0
6264
dishes = list(dishes)
63-
dishes.append(
64-
Dish(
65-
"custom",
66-
name="Vrije keuze",
67-
description="Zet wat je wil in comment",
68-
price=0,
69-
tags=[],
70-
choices=[],
65+
66+
if attributes.get("free_choice","yes") != "no":
67+
dishes.append(
68+
Dish(
69+
"custom",
70+
name="Vrije keuze",
71+
description="Zet wat je wil in comment",
72+
price=0,
73+
tags=[],
74+
choices=[],
75+
)
7176
)
72-
)
7377

74-
attributes = {att["key"]: att["value"] for att in ast["attributes"]}
7578

7679
return Location(
7780
ast["id"],

0 commit comments

Comments
 (0)