mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from enum import Enum
|
|
|
|
from backend.app.db.models.uploaded_file import FileTypeEnum
|
|
|
|
|
|
class FileDownloadButtonType(Enum):
|
|
ASSESSOR_HUB_SITENOTE_REPORT = 11
|
|
CERTIFICATE = 9
|
|
SITENOTE_REPORT = 8
|
|
RAW_XML = 7
|
|
SAP_WORK_SHEET = 15
|
|
|
|
|
|
REPORT_TYPES = [
|
|
FileDownloadButtonType.ASSESSOR_HUB_SITENOTE_REPORT.value,
|
|
FileDownloadButtonType.SITENOTE_REPORT.value,
|
|
FileDownloadButtonType.RAW_XML.value,
|
|
]
|
|
|
|
|
|
def map_report_type_to_db_file_type(report_type: int) -> FileTypeEnum:
|
|
match report_type:
|
|
case FileDownloadButtonType.ASSESSOR_HUB_SITENOTE_REPORT.value:
|
|
return FileTypeEnum.ECMK_SITE_NOTE
|
|
case FileDownloadButtonType.SITENOTE_REPORT.value:
|
|
return FileTypeEnum.ECMK_RD_SAP_SITE_NOTE
|
|
case FileDownloadButtonType.RAW_XML.value:
|
|
return FileTypeEnum.ECMK_SURVEY_XML
|
|
case _:
|
|
raise ValueError("Unknown report type")
|
|
|
|
|
|
def build_report_selector(report_type: int) -> str:
|
|
return f"a.download-report-btn[data-report-type='{report_type}']"
|
|
|
|
|
|
def build_property_id(address: str, postcode: str) -> str:
|
|
number = address.split(" ")[0]
|
|
postcode_clean = postcode.replace(" ", "").upper()
|
|
return f"{number}{postcode_clean}"
|