Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/app/services/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions backend/app/services/reservations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
from decimal import Decimal
from typing import Dict, Any, List

Expand All @@ -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}")

Expand Down