fix: use entity_to_row for backup CSV output and handle non-numeric state values
Switch backup to write converted entities instead of raw table rows via entity_to_row, and map string state values like "Payed"/"Recived" to their integer equivalents during CSV parsing. Add sandbox.toml config. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -43,8 +43,14 @@ def parse_row(raw: dict[str, str]) -> dict[str, Any]:
|
||||
result[col] = datetime.fromisoformat(val)
|
||||
elif col in ("revenue", "prodPrice"):
|
||||
result[col] = float(val)
|
||||
elif col in ("prodCount", "state", "ver"):
|
||||
elif col in ("prodCount", "ver"):
|
||||
result[col] = int(val)
|
||||
elif col == "state":
|
||||
try:
|
||||
result[col] = int(val)
|
||||
except ValueError:
|
||||
_STATE_MAP = {"Payed": 0, "Recived": 1}
|
||||
result[col] = _STATE_MAP.get(val, val)
|
||||
else:
|
||||
result[col] = val
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user