Ignored IPs not applied #836

This commit is contained in:
jokob-sk
2024-10-12 10:49:29 +11:00
parent d6164a005b
commit dcfeb51aa1
23 changed files with 159 additions and 55 deletions

View File

@@ -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})'