multi sector clustering erroro rasing, adn tasks page word coutn monthly limits removal
This commit is contained in:
@@ -292,7 +292,6 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
content_type_filter = request.query_params.get('content_type', '')
|
||||
content_structure_filter = request.query_params.get('content_structure', '')
|
||||
cluster_filter = request.query_params.get('cluster', '')
|
||||
source_filter = request.query_params.get('source', '')
|
||||
search = request.query_params.get('search', '')
|
||||
|
||||
# Apply search to base queryset
|
||||
@@ -310,8 +309,6 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
status_qs = status_qs.filter(content_structure=content_structure_filter)
|
||||
if cluster_filter:
|
||||
status_qs = status_qs.filter(cluster_id=cluster_filter)
|
||||
if source_filter:
|
||||
status_qs = status_qs.filter(source=source_filter)
|
||||
statuses = list(set(status_qs.values_list('status', flat=True)))
|
||||
statuses = sorted([s for s in statuses if s])
|
||||
status_labels = {
|
||||
@@ -333,8 +330,6 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
type_qs = type_qs.filter(content_structure=content_structure_filter)
|
||||
if cluster_filter:
|
||||
type_qs = type_qs.filter(cluster_id=cluster_filter)
|
||||
if source_filter:
|
||||
type_qs = type_qs.filter(source=source_filter)
|
||||
content_types = list(set(type_qs.values_list('content_type', flat=True)))
|
||||
content_types = sorted([t for t in content_types if t])
|
||||
type_labels = {
|
||||
@@ -356,8 +351,6 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
structure_qs = structure_qs.filter(content_type=content_type_filter)
|
||||
if cluster_filter:
|
||||
structure_qs = structure_qs.filter(cluster_id=cluster_filter)
|
||||
if source_filter:
|
||||
structure_qs = structure_qs.filter(source=source_filter)
|
||||
structures = list(set(structure_qs.values_list('content_structure', flat=True)))
|
||||
structures = sorted([s for s in structures if s])
|
||||
structure_labels = {
|
||||
@@ -381,8 +374,6 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
cluster_qs = cluster_qs.filter(content_type=content_type_filter)
|
||||
if content_structure_filter:
|
||||
cluster_qs = cluster_qs.filter(content_structure=content_structure_filter)
|
||||
if source_filter:
|
||||
cluster_qs = cluster_qs.filter(source=source_filter)
|
||||
from igny8_core.modules.planner.models import Clusters
|
||||
cluster_ids = list(set(
|
||||
cluster_qs.exclude(cluster_id__isnull=True)
|
||||
@@ -394,35 +385,12 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
for c in clusters
|
||||
]
|
||||
|
||||
# Get sources (filtered by other fields)
|
||||
source_qs = base_qs
|
||||
if status_filter:
|
||||
source_qs = source_qs.filter(status=status_filter)
|
||||
if content_type_filter:
|
||||
source_qs = source_qs.filter(content_type=content_type_filter)
|
||||
if content_structure_filter:
|
||||
source_qs = source_qs.filter(content_structure=content_structure_filter)
|
||||
if cluster_filter:
|
||||
source_qs = source_qs.filter(cluster_id=cluster_filter)
|
||||
sources = list(set(source_qs.values_list('source', flat=True)))
|
||||
sources = sorted([s for s in sources if s])
|
||||
source_labels = {
|
||||
'manual': 'Manual',
|
||||
'planner': 'Planner',
|
||||
'ai': 'AI',
|
||||
}
|
||||
source_options = [
|
||||
{'value': s, 'label': source_labels.get(s, s.title())}
|
||||
for s in sources
|
||||
]
|
||||
|
||||
return success_response(
|
||||
data={
|
||||
'statuses': status_options,
|
||||
'content_types': content_type_options,
|
||||
'content_structures': content_structure_options,
|
||||
'clusters': cluster_options,
|
||||
'sources': source_options,
|
||||
},
|
||||
request=request
|
||||
)
|
||||
@@ -970,16 +938,6 @@ class ContentViewSet(SiteSectorModelViewSet):
|
||||
word_count = calculate_word_count(html_content)
|
||||
serializer.validated_data['word_count'] = word_count
|
||||
|
||||
# Check monthly word count limit (enforces ALL entry points: manual, import, AI, automation)
|
||||
if account and word_count > 0:
|
||||
from igny8_core.business.billing.services.limit_service import LimitService, MonthlyLimitExceededError
|
||||
from rest_framework.exceptions import ValidationError
|
||||
|
||||
try:
|
||||
LimitService.check_monthly_limit(account, 'content_words', amount=word_count)
|
||||
except MonthlyLimitExceededError as e:
|
||||
raise ValidationError(str(e))
|
||||
|
||||
if account:
|
||||
serializer.save(account=account)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user