added scheduler v2
All checks were successful
Test Build / test-build (push) Successful in 25s

This commit is contained in:
2025-07-31 03:50:08 +03:00
parent 4f66edbb21
commit 0a17b31c06
6 changed files with 430 additions and 94 deletions

View File

@@ -141,6 +141,18 @@ def get_dates(start_date, end_date):
return start_date, end_date
def _parse_cron_string(cron_str):
"""Парсит строку cron в словарь для APScheduler."""
if not isinstance(cron_str, str):
raise TypeError("cron_str must be a string.")
parts = cron_str.split()
if len(parts) != 5:
raise ValueError("Invalid cron string format. Expected 5 parts.")
keys = ['minute', 'hour', 'day', 'month', 'day_of_week']
return {keys[i]: part for i, part in enumerate(parts)}
def calculate_period_dates(period_key):
"""
Вычисляет начальную и конечную даты на основе строкового ключа.