feat(turnstile): двухконтурный учет СКУД, реестры исключений с автокомплитом 1С и калибровка таймзон
This commit is contained in:
@@ -29,7 +29,15 @@ def init_exceptions_table():
|
||||
|
||||
def get_all_exceptions_from_db() -> Dict[str, List[str]]:
|
||||
init_exceptions_table()
|
||||
cfg = {"departments": [], "positions": [], "fio": [], "position_keywords": [], "include_fio": []}
|
||||
cfg = {
|
||||
"departments": [],
|
||||
"positions": [],
|
||||
"fio": [],
|
||||
"position_keywords": [],
|
||||
"include_fio": [],
|
||||
"turnstile_fio": [],
|
||||
"turnstile_departments": []
|
||||
}
|
||||
|
||||
with get_connection() as conn:
|
||||
cursor = conn.cursor()
|
||||
@@ -37,7 +45,6 @@ def get_all_exceptions_from_db() -> Dict[str, List[str]]:
|
||||
rows = cursor.fetchall()
|
||||
|
||||
if not rows and os.path.exists(EXCEPTIONS_PATH):
|
||||
# Первичная миграция из JSON в SQLite
|
||||
sync_json_to_db()
|
||||
return get_all_exceptions_from_db()
|
||||
|
||||
@@ -49,7 +56,8 @@ def get_all_exceptions_from_db() -> Dict[str, List[str]]:
|
||||
|
||||
def add_exception_to_db(category: str, value: str, comment: str = "") -> bool:
|
||||
init_exceptions_table()
|
||||
val_clean = normalize_fio(value) if category in ["fio", "include_fio"] else value.strip()
|
||||
# ФИО очищаем и приводим к нормализованному виду
|
||||
val_clean = normalize_fio(value) if category in ["fio", "include_fio", "turnstile_fio"] else value.strip()
|
||||
if not val_clean:
|
||||
return False
|
||||
with get_connection() as conn:
|
||||
|
||||
Reference in New Issue
Block a user