workout-tracker / tracker /config_updates.py
ronheichman's picture
Deploy workout tracker
234891d verified
Raw
History Blame Contribute Delete
446 Bytes
from __future__ import annotations
import yaml
from tracker.config import _TRACKER_REPO_ROOT
def patch_active_program_id(program_id: int | None) -> None:
"""Rewrite `active_program_id` in config.yaml at the tracker repo root."""
path = _TRACKER_REPO_ROOT / "config.yaml"
raw = yaml.safe_load(path.read_text())
raw["active_program_id"] = program_id
path.write_text(yaml.safe_dump(raw, sort_keys=False, allow_unicode=True))