fix: ignore destroyed proxies in risk score calculation

This commit is contained in:
Iain Learmonth 2024-11-09 12:53:53 +00:00
parent b49e527bf6
commit 0aa41b303d

View file

@ -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()