#!/usr/bin/env python
"""Fix remaining cluster with old status"""
import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'igny8_core.settings')
django.setup()

from igny8_core.business.planning.models import Clusters

cluster = Clusters.objects.filter(status='active').first()
if cluster:
    print(f"Found cluster: ID={cluster.id}, name={cluster.name}, status={cluster.status}")
    print(f"Ideas count: {cluster.ideas.count()}")
    if cluster.ideas.exists():
        cluster.status = 'mapped'
    else:
        cluster.status = 'new'
    cluster.save()
    print(f"Updated to: {cluster.status}")
else:
    print("No clusters with 'active' status found")
