fix incorrect variable in apply_transpose_words_automations

This commit is contained in:
smilerz 2023-08-10 08:33:02 -05:00
parent 9b50ea4c22
commit 2f617aa40f
No known key found for this signature in database
GPG Key ID: 39444C7606D47126

View File

@ -290,7 +290,7 @@ class IngredientParser:
for rule in Automation.objects.filter(space=self.request.space, type=Automation.TRANSPOSE_WORDS, disabled=False) \
.annotate(param_1_lower=Lower('param_1'), param_2_lower=Lower('param_2')) \
.filter(Q(Q(param_1_lower__in=tokens) | Q(param_2_lower__in=tokens))).order_by('order'):
ingredient = re.sub(rf"\b({v[0]})\W*({v[1]})\b", r"\2 \1", ingredient, flags=re.IGNORECASE)
ingredient = re.sub(rf"\b({rule.param_1})\W*({rule.param_1})\b", r"\2 \1", ingredient, flags=re.IGNORECASE)
return ingredient
def parse(self, ingredient):