chore: clean up product display in hotel and cleaner interfacing

This commit is contained in:
2025-12-05 11:45:16 +01:00
parent 93fb465cbb
commit 9041af2979
7 changed files with 60 additions and 19 deletions

View File

@@ -290,8 +290,14 @@ async def get_products(
query = supabase.table(table).select('*')
# filter by exact date_index if provided
# dateIndex from frontend is days from today, convert to days since epoch
if dateIndex is not None:
query = query.eq('date_index', dateIndex)
from datetime import datetime
epoch = datetime(1970, 1, 1)
today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
today_index = int((today - epoch).total_seconds() / 86400)
actual_date_index = today_index + dateIndex
query = query.eq('date_index', actual_date_index)
response = query.execute()
results = response.data