#!/usr/bin/env python
"""Check recent keyword creation"""
import os
import django

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

from igny8_core.business.planning.models import Keywords
from django.utils import timezone
from datetime import timedelta

recent = timezone.now() - timedelta(hours=24)
recent_keywords = Keywords.objects.filter(created_at__gte=recent)

print(f'Keywords created in last 24 hours: {recent_keywords.count()}')
if recent_keywords.exists():
    print('\nRecent keyword statuses:')
    for k in recent_keywords[:10]:
        print(f'  ID {k.id}: status={k.status}, created={k.created_at}')
