- Add 'test' to ForumTopic.CATEGORIES with Polish label 'Testowy' - Add gray styling for test topics (badge + card opacity) - Add scripts to list and mark test topics
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Oznacz wszystkie obecne wątki forum jako testowe."""
|
|
|
|
import os
|
|
import sys
|
|
from dotenv import load_dotenv
|
|
|
|
# Load .env first
|
|
load_dotenv()
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from database import SessionLocal, ForumTopic, ForumReply
|
|
|
|
def main():
|
|
db = SessionLocal()
|
|
|
|
# Pobierz wszystkie wątki
|
|
topics = db.query(ForumTopic).all()
|
|
|
|
print(f"Znaleziono {len(topics)} wątków do oznaczenia jako testowe...")
|
|
print()
|
|
|
|
for topic in topics:
|
|
old_category = topic.category
|
|
topic.category = 'test'
|
|
print(f" ID {topic.id}: {topic.title[:50]}... ({old_category} → test)")
|
|
|
|
# Oznacz też odpowiedzi jako AI-generated (jeśli są testowe)
|
|
replies = db.query(ForumReply).all()
|
|
for reply in replies:
|
|
reply.is_ai_generated = True
|
|
|
|
print()
|
|
print(f"Oznaczono {len(topics)} wątków jako 'test'")
|
|
print(f"Oznaczono {len(replies)} odpowiedzi jako AI-generated")
|
|
|
|
db.commit()
|
|
db.close()
|
|
|
|
print()
|
|
print("Gotowe!")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|