mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Skip and report a document with no Document Type 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
34c48d4adc
commit
bd928828e3
1 changed files with 11 additions and 2 deletions
|
|
@ -64,8 +64,17 @@ def plan_download_package(
|
|||
per property, the latest file of each Document Type, null-Document-Type rows
|
||||
skipped and reported."""
|
||||
latest_by_group: dict[tuple[str, str], ResolvedDocument] = {}
|
||||
skipped: list[SkippedDocument] = []
|
||||
for document in documents:
|
||||
assert document.document_type is not None
|
||||
if document.document_type is None:
|
||||
skipped.append(
|
||||
SkippedDocument(
|
||||
landlord_property_id=document.landlord_property_id,
|
||||
s3_key=document.s3_key,
|
||||
reason="null_document_type",
|
||||
)
|
||||
)
|
||||
continue
|
||||
group = (document.landlord_property_id, document.document_type)
|
||||
incumbent = latest_by_group.get(group)
|
||||
if incumbent is None or document.uploaded_at > incumbent.uploaded_at:
|
||||
|
|
@ -80,4 +89,4 @@ def plan_download_package(
|
|||
)
|
||||
for document in latest_by_group.values()
|
||||
]
|
||||
return DownloadPackagePlan(entries=tuple(entries), skipped=())
|
||||
return DownloadPackagePlan(entries=tuple(entries), skipped=tuple(skipped))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue