diff --git a/backend/src/plugins/Counters/types.ts b/backend/src/plugins/Counters/types.ts index 289d06125..6734e8ce0 100644 --- a/backend/src/plugins/Counters/types.ts +++ b/backend/src/plugins/Counters/types.ts @@ -32,7 +32,7 @@ export const zTrigger = z .optional(), }) .transform((val, ctx) => { - const ruleName = String(ctx.path[ctx.path.length - 2]).trim(); + const ruleName = String(ctx.path[ctx.path.length - 1]).trim(); let reverseCondition = val.reverse_condition; if (!reverseCondition) { @@ -51,7 +51,7 @@ export const zTrigger = z }); const zTriggerFromString = zBoundedCharacters(0, 100).transform((val, ctx) => { - const ruleName = String(ctx.path[ctx.path.length - 2]).trim(); + const ruleName = String(ctx.path[ctx.path.length - 1]).trim(); const parsedCondition = parseCounterConditionString(val); if (!parsedCondition) { ctx.addIssue({