Compare commits

..

No commits in common. "3a2bb6c8aa9b38c41c96d89c7be86d22cc0a1b71" and "efe6df992d0b5d756fb40b84292199891d4fdc4f" have entirely different histories.

View File

@ -40,17 +40,6 @@ ZIP_MEDIA_TYPE = "application/zip"
FORM1_DIRECTION_REQUIRED_SHEETS = {"AHR", "CAP"}
SHEETS_WITH_SECTIONS = {"AHR", "CAP", "OPER"}
SHEET_NAMES = {
'AHR': 'АХР',
'CAP': 'КВП',
'OPER': 'Операц',
'AHR_LIMIT': 'АХР Лимиты',
'AHR_RENT': 'АХР Аренда',
'AHR_SECURITY': 'АХР Безопасность',
'AHR_UTILITY': 'АХР Коммунальные услуги',
'SMETA': 'Смета',
}
SKIP_SHEETS = ('OTCH9F',)
@dataclass(frozen=True)
class ExportSheetPlan:
@ -244,9 +233,6 @@ class ExportService:
workbook = self._create_workbook_with_metadata(form=form)
exported_sheets = 0
for plan in plans:
if not plan.validation_direction and plan.sheet_name in SKIP_SHEETS:
continue
self._validate_sheet_query_params(
form_type_code=form.form_type.code,
sheet=plan.sheet_name,
@ -259,7 +245,7 @@ class ExportService:
direction=plan.effective_direction,
sections=plan.effective_sections,
)
worksheet = workbook.create_sheet(title=self._safe_sheet_name(plan.sheet_name, plan.effective_direction))
worksheet = workbook.create_sheet(title=self._safe_sheet_name(plan.sheet_name))
self._write_sheet_rows(
worksheet=worksheet,
rows=rows,
@ -434,15 +420,7 @@ class ExportService:
return form_type_code == FormTypeEnum.FORM_1 and sheet in FORM1_DIRECTION_REQUIRED_SHEETS
@staticmethod
def _safe_sheet_name(value: str, direction: str | None = None) -> str:
if value in SHEET_NAMES:
sheet_name = SHEET_NAMES[value]
match direction:
case 'Support':
sheet_name = f'{sheet_name}'
case 'Development':
sheet_name = f'{sheet_name}_Р'
return sheet_name
def _safe_sheet_name(value: str) -> str:
safe = value
for char in ("[", "]", ":", "*", "?", "/", "\\"):
safe = safe.replace(char, "_")