Skip to content

Commit

Permalink
feat: add weekday in global unicafe search result
Browse files Browse the repository at this point in the history
  • Loading branch information
lamtonylam committed Aug 2, 2024
1 parent 590b82b commit b147a5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 10 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

app = Flask(__name__)


def furtherst_date_data():
dates = []
for object in response.json():
Expand All @@ -27,28 +28,33 @@ def furtherst_date_data():
dates.append(menu["date"])
return dates[-1][3:]


def check_if_sausage_is_in_week(restaurant_name):
# get the whole week
menu_original = {}
for object in response.json():
if object["title"] == restaurant_name:
for menu in object["menuData"]["menus"]:
menu_original[menu["date"][3:]] = []
menu_original[menu["date"]] = []
data = menu["data"]
for item in data:
menu_original[menu["date"][3:]].append(item["name"])
menu_original[menu["date"]].append(item["name"])

# strip the menu
menu_stripped_from_pastdates = {}
for date_menu in menu_original:
present = datetime.now().strftime("%d.%m.")
# keep the date in the original format
date_menu_original = date_menu
# make date in format without weekday
date_menu = date_menu[3:]
if datetime.strptime(date_menu, "%d.%m.") < datetime.strptime(
present, "%d.%m."
):
pass
else:
menu_stripped_from_pastdates[date_menu] = [
item.lower() for item in menu_original[date_menu]
menu_stripped_from_pastdates[date_menu_original] = [
item.lower() for item in menu_original[date_menu_original]
]

# dates that have sausage
Expand Down
5 changes: 4 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<head>
<title>Mekuma tracker</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<meta
name="google-site-verification"
content="hzvFOzKfX30cjT8owZ5Hsy-o-tJCBmWfs3WuKhgRVVQ"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
Expand Down

0 comments on commit b147a5a

Please sign in to comment.