diff --git a/backend/app/services/cache.py b/backend/app/services/cache.py index b81474957..672e3f9d6 100644 --- a/backend/app/services/cache.py +++ b/backend/app/services/cache.py @@ -10,7 +10,7 @@ async def get_revenue_summary(property_id: str, tenant_id: str) -> Dict[str, Any """ Fetches revenue summary, utilizing caching to improve performance. """ - cache_key = f"revenue:{property_id}" + cache_key = f"revenue:{tenant_id}:{property_id}" # Try to get from cache cached = await redis_client.get(cache_key) diff --git a/backend/app/services/reservations.py b/backend/app/services/reservations.py index 384bd00ab..a4596b83f 100644 --- a/backend/app/services/reservations.py +++ b/backend/app/services/reservations.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timezone from decimal import Decimal from typing import Dict, Any, List @@ -7,11 +7,11 @@ async def calculate_monthly_revenue(property_id: str, month: int, year: int, db_ Calculates revenue for a specific month. """ - start_date = datetime(year, month, 1) + start_date = datetime(year, month, 1, tzinfo=timezone.utc) if month < 12: - end_date = datetime(year, month + 1, 1) + end_date = datetime(year, month + 1, 1, tzinfo=timezone.utc) else: - end_date = datetime(year + 1, 1, 1) + end_date = datetime(year + 1, 1, 1, tzinfo=timezone.utc) print(f"DEBUG: Querying revenue for {property_id} from {start_date} to {end_date}")