"""اختبار إيميل حل المشكلة - تحديث threshold فقط"""
import asyncio
from app.database import AsyncSessionLocal
from app.models.alert import AlertRule
from sqlalchemy import update

async def update_threshold():
    async with AsyncSessionLocal() as session:
        # تغيير الـ threshold إلى 20 (أعلى من القيمة الحالية 17)
        await session.execute(
            update(AlertRule).where(AlertRule.name == "Room 3>10").values(
                threshold_value=10.0
            )
        )
        await session.commit()
        print("✓ Updated threshold to 20 (current temp is 17, so condition NOT met)")
        print("  Now run: python test_alert_task.py")

if __name__ == "__main__":
    asyncio.run(update_threshold())
