diff --git a/src/database.py b/src/database.py index cbee4a0..32a893e 100644 --- a/src/database.py +++ b/src/database.py @@ -815,7 +815,7 @@ class DatabaseManager: def flag_stale_ips_for_reevaluation(self) -> int: """ Flag IPs for reevaluation where: - - last_seen is between 5 and 30 days ago + - last_seen is more than 30 days ago - last_analysis is more than 5 days ago Returns: @@ -824,15 +824,13 @@ class DatabaseManager: session = self.session try: now = datetime.now() - last_seen_lower = now - timedelta(days=30) - last_seen_upper = now - timedelta(days=5) + last_seen_cutoff = now - timedelta(days=30) last_analysis_cutoff = now - timedelta(days=5) count = ( session.query(IpStats) .filter( - IpStats.last_seen >= last_seen_lower, - IpStats.last_seen <= last_seen_upper, + IpStats.last_seen <= last_seen_cutoff, IpStats.last_analysis <= last_analysis_cutoff, IpStats.need_reevaluation == False, IpStats.manual_category == False,