trash models added, first attempt for remainign issues
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user