Skip to content

Commit 12ea0de

Browse files
committed
resolve open violations
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 8fdad32 commit 12ea0de

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

policy/engine.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def evaluate_rules(product):
6767
for rule_type in RULE_REGISTRY:
6868
config = get_effective_config(rule_type, product.dataspace)
6969
if not config["is_active"]:
70+
# Explicitly resolve open violations so disabling a rule clears its history
71+
# rather than leaving stale unresolved records.
72+
ProductPolicyViolation.objects.filter(
73+
rule_type=rule_type, product=product, resolved=False,
74+
).update(resolved=True, resolved_date=timezone.now())
7075
continue
7176

7277
violation = evaluate_rule(rule_type, product, config["threshold"], config["parameters"])

0 commit comments

Comments
 (0)