Implement document reconciliation v2
This commit is contained in:
@@ -743,7 +743,8 @@ def _select_default_documents(template: MessageTemplate, docs: Sequence[Dict[str
|
||||
return []
|
||||
expected = {kind.lower() for kind in template.expected_document_kinds}
|
||||
matching = [doc for doc in docs if str(doc.get("document_kind") or "").lower() in expected]
|
||||
current = [doc for doc in matching if str(doc.get("role") or "current") in {"current", "accepted"} and bool(doc.get("is_primary", True))]
|
||||
current = [doc for doc in matching if str(doc.get("relationship") or "").upper() == "PRIMARY"
|
||||
and str(doc.get("status") or "").upper() not in {"CANCELLED", "CANCELED"}]
|
||||
chosen = current or matching
|
||||
if not chosen:
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user