Creditsupdates in fotoer wdigets adn hoemapge and singe site settigns page #Run MIgration 0033 #MAJOR
This commit is contained in:
@@ -165,6 +165,14 @@ class CreditUsageViewSet(AccountModelViewSet):
|
||||
created_at__gte=start_date,
|
||||
created_at__lte=end_date
|
||||
)
|
||||
|
||||
# Filter by site if provided
|
||||
site_id = request.query_params.get('site_id')
|
||||
if site_id:
|
||||
try:
|
||||
usage_logs = usage_logs.filter(site_id=int(site_id))
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
# Calculate totals
|
||||
total_credits_used = usage_logs.aggregate(total=Sum('credits_used'))['total'] or 0
|
||||
|
||||
Reference in New Issue
Block a user