Compare commits
No commits in common. "3a2bb6c8aa9b38c41c96d89c7be86d22cc0a1b71" and "efe6df992d0b5d756fb40b84292199891d4fdc4f" have entirely different histories.
3a2bb6c8aa
...
efe6df992d
@ -40,17 +40,6 @@ ZIP_MEDIA_TYPE = "application/zip"
|
|||||||
FORM1_DIRECTION_REQUIRED_SHEETS = {"AHR", "CAP"}
|
FORM1_DIRECTION_REQUIRED_SHEETS = {"AHR", "CAP"}
|
||||||
SHEETS_WITH_SECTIONS = {"AHR", "CAP", "OPER"}
|
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)
|
@dataclass(frozen=True)
|
||||||
class ExportSheetPlan:
|
class ExportSheetPlan:
|
||||||
@ -244,9 +233,6 @@ class ExportService:
|
|||||||
workbook = self._create_workbook_with_metadata(form=form)
|
workbook = self._create_workbook_with_metadata(form=form)
|
||||||
exported_sheets = 0
|
exported_sheets = 0
|
||||||
for plan in plans:
|
for plan in plans:
|
||||||
if not plan.validation_direction and plan.sheet_name in SKIP_SHEETS:
|
|
||||||
continue
|
|
||||||
|
|
||||||
self._validate_sheet_query_params(
|
self._validate_sheet_query_params(
|
||||||
form_type_code=form.form_type.code,
|
form_type_code=form.form_type.code,
|
||||||
sheet=plan.sheet_name,
|
sheet=plan.sheet_name,
|
||||||
@ -259,7 +245,7 @@ class ExportService:
|
|||||||
direction=plan.effective_direction,
|
direction=plan.effective_direction,
|
||||||
sections=plan.effective_sections,
|
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(
|
self._write_sheet_rows(
|
||||||
worksheet=worksheet,
|
worksheet=worksheet,
|
||||||
rows=rows,
|
rows=rows,
|
||||||
@ -434,15 +420,7 @@ class ExportService:
|
|||||||
return form_type_code == FormTypeEnum.FORM_1 and sheet in FORM1_DIRECTION_REQUIRED_SHEETS
|
return form_type_code == FormTypeEnum.FORM_1 and sheet in FORM1_DIRECTION_REQUIRED_SHEETS
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _safe_sheet_name(value: str, direction: str | None = None) -> str:
|
def _safe_sheet_name(value: str) -> 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
|
|
||||||
safe = value
|
safe = value
|
||||||
for char in ("[", "]", ":", "*", "?", "/", "\\"):
|
for char in ("[", "]", ":", "*", "?", "/", "\\"):
|
||||||
safe = safe.replace(char, "_")
|
safe = safe.replace(char, "_")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user