修正
This commit is contained in:
17
backend/app/utils/month_lock.py
Normal file
17
backend/app/utils/month_lock.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
Reference in New Issue
Block a user