From 0aa41b303dfe9c1a083ad992494f9cee1bb98633 Mon Sep 17 00:00:00 2001 From: Iain Learmonth Date: Sat, 9 Nov 2024 12:53:53 +0000 Subject: [PATCH] fix: ignore destroyed proxies in risk score calculation --- app/models/mirrors.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/mirrors.py b/app/models/mirrors.py index 10fcdf3..563de53 100644 --- a/app/models/mirrors.py +++ b/app/models/mirrors.py @@ -85,7 +85,8 @@ class Origin(AbstractConfiguration): .filter( Origin.id == self.id, Deprecation.resource_type == 'Proxy', - Deprecation.deprecated_at >= datetime.utcnow() - timedelta(hours=168) + Deprecation.deprecated_at >= datetime.utcnow() - timedelta(hours=168), + Deprecation.reason != "destroyed" ) .distinct(Proxy.id) .all() @@ -130,7 +131,8 @@ class Country(AbstractConfiguration): .filter( Country.id == self.id, Deprecation.resource_type == 'Proxy', - Deprecation.deprecated_at >= datetime.utcnow() - timedelta(hours=168) + Deprecation.deprecated_at >= datetime.utcnow() - timedelta(hours=168), + Deprecation.reason != "destroyed" ) .distinct(Proxy.id) .all()