fix: Use configured server time when calling RepositoryMeals.get_today() method (#4734)

This commit is contained in:
Michael Clark
2024-12-17 14:33:35 -06:00
committed by GitHub
parent afd304f9e5
commit 8d325198e8
3 changed files with 8 additions and 4 deletions

View File

@@ -9,11 +9,11 @@ from .repository_generic import HouseholdRepositoryGeneric
class RepositoryMeals(HouseholdRepositoryGeneric[ReadPlanEntry, GroupMealPlan]):
def get_today(self) -> list[ReadPlanEntry]:
def get_today(self, tz=UTC) -> list[ReadPlanEntry]:
if not self.household_id:
raise Exception("household_id not set")
today = datetime.now(tz=UTC).date()
today = datetime.now(tz=tz).date()
stmt = select(GroupMealPlan).filter(
GroupMealPlan.date == today, GroupMealPlan.household_id == self.household_id
)