18 lines
499 B
Python
18 lines
499 B
Python
from datetime import date
|
|
from app.core.database import get_connection
|
|
|
|
def is_month_locked(target_date: date) -> bool:
|
|
fiscal_year = target_date.year
|
|
month = target_date.month
|
|
|
|
with get_connection() as conn, conn.cursor() as cur:
|
|
cur.execute("""
|
|
SELECT 1
|
|
FROM month_locks
|
|
WHERE fiscal_year = %s
|
|
AND month = %s
|
|
AND is_locked = true
|
|
""", (fiscal_year, month))
|
|
|
|
return cur.fetchone() is not None
|