trash models added, first attempt for remainign issues

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-12 13:39:42 +00:00
parent 28cb698579
commit 7d4d309677
20 changed files with 1084 additions and 106 deletions

View File

@@ -590,15 +590,25 @@ class AutomationViewSet(viewsets.ViewSet):
# Get the run
run = AutomationRun.objects.get(run_id=run_id, site=site)
# If not running, return None
if run.status != 'running':
# If not running or paused, return minimal state with updated credits
if run.status not in ('running', 'paused'):
return Response({'data': None})
# Get current processing state
service = AutomationService.from_run_id(run_id)
state = service.get_current_processing_state()
return Response({'data': state})
# Refresh run to get latest total_credits_used
run.refresh_from_db()
# Add updated credits info to response
response_data = {
'state': state,
'total_credits_used': run.total_credits_used,
'current_stage': run.current_stage,
}
return Response({'data': response_data})
except AutomationRun.DoesNotExist:
return Response(