wp plugin and app fixes adn automation page update

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-12 01:12:08 +00:00
parent 3925ddf894
commit 90b9d6aadc
19 changed files with 1918 additions and 336 deletions

View File

@@ -516,6 +516,57 @@ class AutomationViewSet(viewsets.ViewSet):
]
})
@extend_schema(tags=['Automation'])
@action(detail=False, methods=['get'])
def eligibility(self, request):
"""
GET /api/v1/automation/eligibility/?site_id=123
Check if site is eligible for automation.
A site is eligible if it has ANY data in the pipeline:
- At least one keyword, OR
- At least one cluster, OR
- At least one idea, OR
- At least one task, OR
- At least one content item, OR
- At least one image
Sites with zero data across ALL entities are not eligible.
"""
site, error_response = self._get_site(request)
if error_response:
return error_response
from igny8_core.business.planning.models import Keywords, Clusters, ContentIdeas
from igny8_core.business.content.models import Tasks, Content, Images
# Check total counts for each entity
keywords_total = Keywords.objects.filter(site=site, disabled=False).count()
clusters_total = Clusters.objects.filter(site=site, disabled=False).count()
ideas_total = ContentIdeas.objects.filter(site=site).count()
tasks_total = Tasks.objects.filter(site=site).count()
content_total = Content.objects.filter(site=site).count()
images_total = Images.objects.filter(site=site).count()
# Site is eligible if ANY of these totals is > 0
total_items = keywords_total + clusters_total + ideas_total + tasks_total + content_total + images_total
is_eligible = total_items > 0
# Provide details for the UI
return Response({
'is_eligible': is_eligible,
'totals': {
'keywords': keywords_total,
'clusters': clusters_total,
'ideas': ideas_total,
'tasks': tasks_total,
'content': content_total,
'images': images_total,
},
'total_items': total_items,
'message': None if is_eligible else 'This site has no data yet. Add keywords in the Planner module to get started with automation.'
})
@extend_schema(tags=['Automation'])
@action(detail=False, methods=['get'], url_path='current_processing')
def current_processing(self, request):