mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Ignored IPs not applied #836
This commit is contained in:
@@ -462,19 +462,23 @@ def list_to_where(logical_operator, column_name, condition_operator, values_list
|
||||
- A string representing the WHERE condition.
|
||||
"""
|
||||
|
||||
# If the list is empty, return an empty string
|
||||
if not values_list:
|
||||
return " AND 1=1 " # Return a conditioneitehr way if the list is empty to avoid breaking the SQL condition.
|
||||
return ""
|
||||
|
||||
# Replace {s-quote} with single quote in values_list
|
||||
values_list = [value.replace("{s-quote}", "'") for value in values_list]
|
||||
|
||||
# Build the WHERE condition
|
||||
# Build the WHERE condition for the first value
|
||||
condition = f"{column_name} {condition_operator} '{values_list[0]}'"
|
||||
|
||||
# Add the rest of the values using the logical operator
|
||||
for value in values_list[1:]:
|
||||
condition += f" {logical_operator} {column_name} {condition_operator} '{value}'"
|
||||
|
||||
return f' AND ({condition}) '
|
||||
return f'({condition})'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user