This commit is contained in:
2026-01-04 01:01:07 +03:00
parent c80e8c6935
commit 53b846009b
10 changed files with 97 additions and 51 deletions
@@ -1,9 +1,7 @@
from datetime import datetime
from dishka import AsyncContainer
from trudex.infrastructure.database.dao.test import TestDAO
from trudex.infrastructure.database.models import Test
from trudex.infrastructure.utils.timezone import now_msk
async def deactivate_expired_tests(container: AsyncContainer):
@@ -13,5 +11,5 @@ async def deactivate_expired_tests(container: AsyncContainer):
tests = await test_dao.get_all()
for test in tests:
if test.expires_at and test.expires_at < datetime.utcnow() and test.is_active:
if test.expires_at and test.expires_at < now_msk() and test.is_active:
await test_dao.update(test.id, is_active=False)