Ensure detections are not immediately deleted (#13683)

* Ensure detections are not immediately deleted

* Formatting
This commit is contained in:
Nicolas Mowen 2024-09-11 14:46:24 -06:00 committed by GitHub
parent f3784505e0
commit 62657ad05a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -192,7 +192,10 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
"default" "default"
] ]
else: else:
detections_retention["retain"]["days"] = 0 continuous_days = config.get("record", {}).get("retain", {}).get("days")
detections_retention["retain"]["days"] = (
continuous_days if continuous_days else 1
)
new_config["record"]["alerts"] = alerts_retention new_config["record"]["alerts"] = alerts_retention
new_config["record"]["detections"] = detections_retention new_config["record"]["detections"] = detections_retention
@ -232,7 +235,12 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
"default" "default"
] ]
else: else:
detections_retention["retain"]["days"] = 0 continuous_days = (
camera_config.get("record", {}).get("retain", {}).get("days")
)
detections_retention["retain"]["days"] = (
continuous_days if continuous_days else 1
)
camera_config["record"]["alerts"] = alerts_retention camera_config["record"]["alerts"] = alerts_retention
camera_config["record"]["detections"] = detections_retention camera_config["record"]["detections"] = detections_retention