mirror of
https://github.com/hoshikawa2/mdm_project.git
synced 2026-03-06 18:21:04 +00:00
First commit
This commit is contained in:
10
files/services/golden_service.py
Normal file
10
files/services/golden_service.py
Normal file
@@ -0,0 +1,10 @@
|
||||
def pick_golden(rows):
|
||||
if not rows: return {}
|
||||
def score(r): return (5 if r.get("source") in ("ERP","CRM") else 0) + sum(1 for v in r.values() if v not in (None,"",[],{}))
|
||||
best = max(rows, key=score)
|
||||
gold = dict(best)
|
||||
for r in rows:
|
||||
for k,v in r.items():
|
||||
if gold.get(k) in (None,"",[],{}) and v not in (None,"",[],{}):
|
||||
gold[k]=v
|
||||
return gold
|
||||
Reference in New Issue
Block a user