feat(import): resolve color variety ID mappings mismatch, support unnamed parents in virtual litters, and implement SaleContract updates

This commit is contained in:
2026-06-21 21:57:40 +02:00
parent b83e96f552
commit e460cd5905
29 changed files with 3783 additions and 67 deletions

View File

@@ -323,9 +323,10 @@ def _reconstruct_parents(animals):
father = above[-1] if above else None
mother = below[0] if below else None
for parent, role in ((father, "father"), (mother, "mother")):
if parent and parent["name"]:
if parent:
p_name = parent["name"] or "unbekannt"
a["parentRefs"].append({
"name": parent["name"],
"name": p_name,
"dob": parent["dob"],
"roleGuess": role,
"method": "chart-position",
@@ -348,7 +349,7 @@ def _attach_photos(z, sheets, animals, fname):
if not cands:
# fall back to nearest animal by row across all gens
cands = animals
target = min(cands, key=lambda a: abs(a["_row"] - row)) if cands else None
target = min(cands, key=lambda a: abs((a["_row"] - row) - 10)) if cands else None
if not target:
continue
ext = os.path.splitext(media)[1] or ".img"