fixed recurring IPs now only count bans, not unbans

This commit is contained in:
2025-12-30 11:35:32 +01:00
parent 75325767a5
commit 11c312b11b

View File

@@ -669,7 +669,7 @@ func CountBanEventsByIP(ctx context.Context, ip, serverID string) (int64, error)
query := ` query := `
SELECT COUNT(*) SELECT COUNT(*)
FROM ban_events FROM ban_events
WHERE ip = ?` WHERE ip = ? AND (event_type = 'ban' OR event_type IS NULL)`
args := []any{ip} args := []any{ip}
if serverID != "" { if serverID != "" {
@@ -743,7 +743,7 @@ func ListRecurringIPStats(ctx context.Context, since time.Time, minCount, limit
query := ` query := `
SELECT ip, COALESCE(country, '') AS country, COUNT(*) AS cnt, MAX(occurred_at) AS last_seen SELECT ip, COALESCE(country, '') AS country, COUNT(*) AS cnt, MAX(occurred_at) AS last_seen
FROM ban_events FROM ban_events
WHERE ip != ''` WHERE ip != '' AND (event_type = 'ban' OR event_type IS NULL)`
args := []any{} args := []any{}
if serverID != "" { if serverID != "" {