feat: сортировка допников по doc_date
This commit is contained in:
@@ -17,6 +17,9 @@ def run_pipeline(contract_id, order_ids, sse_send, build_prompt_fn):
|
|||||||
order_list = [x.strip() for x in order_ids.split(",") if x.strip()]
|
order_list = [x.strip() for x in order_ids.split(",") if x.strip()]
|
||||||
order_map = {oid: i for i, oid in enumerate(order_list)}
|
order_map = {oid: i for i, oid in enumerate(order_list)}
|
||||||
supps.sort(key=lambda s: order_map.get(s["id"], 999999))
|
supps.sort(key=lambda s: order_map.get(s["id"], 999999))
|
||||||
|
else:
|
||||||
|
# Sort by doc_date (from classification), fallback to created_at
|
||||||
|
supps.sort(key=lambda s: (s.get("doc_date") or "9999-99-99", s.get("created_at", "")))
|
||||||
|
|
||||||
if not supps:
|
if not supps:
|
||||||
sse_send({"type": "error", "message": "Нет распарсенных файлов"})
|
sse_send({"type": "error", "message": "Нет распарсенных файлов"})
|
||||||
|
|||||||
Reference in New Issue
Block a user