fixes and final pre launch verifcation md
This commit is contained in:
@@ -171,6 +171,8 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
site = get_object_or_404(Site, id=site_id, account=request.user.account)
|
||||
data = request.data
|
||||
|
||||
logger.info(f"[UnifiedSettings] Received update for site {site_id}: {data}")
|
||||
|
||||
try:
|
||||
# Get or create AutomationConfig
|
||||
automation_config, _ = AutomationConfig.objects.get_or_create(
|
||||
@@ -194,6 +196,7 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
|
||||
# Update stage configuration
|
||||
if 'stages' in data:
|
||||
logger.info(f"[UnifiedSettings] Updating stages: {data['stages']}")
|
||||
self._update_stage_config(automation_config, data['stages'])
|
||||
|
||||
# Update delays
|
||||
@@ -205,6 +208,7 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.between_stage_delay = delays['between_stage']
|
||||
|
||||
automation_config.save()
|
||||
logger.info(f"[UnifiedSettings] AutomationConfig saved for site {site_id}")
|
||||
|
||||
# Update publishing settings
|
||||
if 'publishing' in data:
|
||||
@@ -239,13 +243,15 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
'enabled': automation_config.stage_1_enabled,
|
||||
'batch_size': automation_config.stage_1_batch_size,
|
||||
'per_run_limit': automation_config.max_keywords_per_run,
|
||||
'use_testing': False, # Default, can be stored in metadata later
|
||||
'use_testing': automation_config.stage_1_use_testing,
|
||||
'budget_pct': automation_config.stage_1_budget_pct,
|
||||
},
|
||||
'2': {
|
||||
'enabled': automation_config.stage_2_enabled,
|
||||
'batch_size': automation_config.stage_2_batch_size,
|
||||
'per_run_limit': automation_config.max_clusters_per_run,
|
||||
'use_testing': False,
|
||||
'use_testing': automation_config.stage_2_use_testing,
|
||||
'budget_pct': automation_config.stage_2_budget_pct,
|
||||
},
|
||||
'3': {
|
||||
'enabled': automation_config.stage_3_enabled,
|
||||
@@ -256,19 +262,22 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
'enabled': automation_config.stage_4_enabled,
|
||||
'batch_size': automation_config.stage_4_batch_size,
|
||||
'per_run_limit': automation_config.max_tasks_per_run,
|
||||
'use_testing': False,
|
||||
'use_testing': automation_config.stage_4_use_testing,
|
||||
'budget_pct': automation_config.stage_4_budget_pct,
|
||||
},
|
||||
'5': {
|
||||
'enabled': automation_config.stage_5_enabled,
|
||||
'batch_size': automation_config.stage_5_batch_size,
|
||||
'per_run_limit': automation_config.max_content_per_run,
|
||||
'use_testing': False,
|
||||
'use_testing': automation_config.stage_5_use_testing,
|
||||
'budget_pct': automation_config.stage_5_budget_pct,
|
||||
},
|
||||
'6': {
|
||||
'enabled': automation_config.stage_6_enabled,
|
||||
'batch_size': automation_config.stage_6_batch_size,
|
||||
'per_run_limit': automation_config.max_images_per_run,
|
||||
'use_testing': False,
|
||||
'use_testing': automation_config.stage_6_use_testing,
|
||||
'budget_pct': automation_config.stage_6_budget_pct,
|
||||
},
|
||||
'7': {
|
||||
'enabled': automation_config.stage_7_enabled,
|
||||
@@ -306,8 +315,11 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
for stage in stages:
|
||||
num = stage.get('number')
|
||||
if not num:
|
||||
logger.warning(f"[UnifiedSettings] Stage missing 'number': {stage}")
|
||||
continue
|
||||
|
||||
logger.info(f"[UnifiedSettings] Processing stage {num}: enabled={stage.get('enabled')}, batch_size={stage.get('batch_size')}, per_run_limit={stage.get('per_run_limit')}, use_testing={stage.get('use_testing')}, budget_pct={stage.get('budget_pct')}")
|
||||
|
||||
if num == 1:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_1_enabled = stage['enabled']
|
||||
@@ -315,6 +327,10 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.stage_1_batch_size = stage['batch_size']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_keywords_per_run = stage['per_run_limit']
|
||||
if 'use_testing' in stage:
|
||||
automation_config.stage_1_use_testing = stage['use_testing']
|
||||
if 'budget_pct' in stage:
|
||||
automation_config.stage_1_budget_pct = stage['budget_pct']
|
||||
elif num == 2:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_2_enabled = stage['enabled']
|
||||
@@ -322,6 +338,10 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.stage_2_batch_size = stage['batch_size']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_clusters_per_run = stage['per_run_limit']
|
||||
if 'use_testing' in stage:
|
||||
automation_config.stage_2_use_testing = stage['use_testing']
|
||||
if 'budget_pct' in stage:
|
||||
automation_config.stage_2_budget_pct = stage['budget_pct']
|
||||
elif num == 3:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_3_enabled = stage['enabled']
|
||||
@@ -336,6 +356,10 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.stage_4_batch_size = stage['batch_size']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_tasks_per_run = stage['per_run_limit']
|
||||
if 'use_testing' in stage:
|
||||
automation_config.stage_4_use_testing = stage['use_testing']
|
||||
if 'budget_pct' in stage:
|
||||
automation_config.stage_4_budget_pct = stage['budget_pct']
|
||||
elif num == 5:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_5_enabled = stage['enabled']
|
||||
@@ -343,6 +367,10 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.stage_5_batch_size = stage['batch_size']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_content_per_run = stage['per_run_limit']
|
||||
if 'use_testing' in stage:
|
||||
automation_config.stage_5_use_testing = stage['use_testing']
|
||||
if 'budget_pct' in stage:
|
||||
automation_config.stage_5_budget_pct = stage['budget_pct']
|
||||
elif num == 6:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_6_enabled = stage['enabled']
|
||||
@@ -350,8 +378,14 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
automation_config.stage_6_batch_size = stage['batch_size']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_images_per_run = stage['per_run_limit']
|
||||
if 'use_testing' in stage:
|
||||
automation_config.stage_6_use_testing = stage['use_testing']
|
||||
if 'budget_pct' in stage:
|
||||
automation_config.stage_6_budget_pct = stage['budget_pct']
|
||||
elif num == 7:
|
||||
if 'enabled' in stage:
|
||||
automation_config.stage_7_enabled = stage['enabled']
|
||||
if 'per_run_limit' in stage:
|
||||
automation_config.max_approvals_per_run = stage['per_run_limit']
|
||||
|
||||
logger.info(f"[UnifiedSettings] After update - stage_1_batch_size={automation_config.stage_1_batch_size}, max_keywords_per_run={automation_config.max_keywords_per_run}")
|
||||
|
||||
Reference in New Issue
Block a user