fix low level issues
This commit is contained in:
+16
-2
@@ -140,13 +140,27 @@ def merge_all(data_dir: Path) -> int:
|
||||
if not dest_img.exists():
|
||||
dest_img.symlink_to(img_dir.resolve())
|
||||
|
||||
# Symlink athlete.json if present
|
||||
# Produce merged athlete.json — base from extract overlaid with edits/athlete.yaml
|
||||
athlete_src = data_dir / "athlete.json"
|
||||
athlete_dest = merged_dir / "athlete.json"
|
||||
if athlete_dest.exists() or athlete_dest.is_symlink():
|
||||
athlete_dest.unlink()
|
||||
if athlete_src.exists():
|
||||
athlete_dest.symlink_to(athlete_src.resolve())
|
||||
athlete_edits_path = data_dir / "edits" / "athlete.yaml"
|
||||
if athlete_edits_path.exists():
|
||||
try:
|
||||
import yaml as _yaml
|
||||
edits = _yaml.safe_load(athlete_edits_path.read_text(encoding="utf-8")) or {}
|
||||
except Exception:
|
||||
edits = {}
|
||||
else:
|
||||
edits = {}
|
||||
if edits:
|
||||
athlete_data = json.loads(athlete_src.read_text(encoding="utf-8"))
|
||||
athlete_data.update(edits)
|
||||
athlete_dest.write_text(json.dumps(athlete_data, indent=2, ensure_ascii=False))
|
||||
else:
|
||||
athlete_dest.symlink_to(athlete_src.resolve())
|
||||
|
||||
# Write merged index.json (private filtered, highlight sorted)
|
||||
index_path = data_dir / "index.json"
|
||||
|
||||
Reference in New Issue
Block a user