From c3742e15858d6bed86723e81b14481c6cadcdb29 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Sun, 24 May 2026 14:27:42 -0400 Subject: [PATCH] Fix NCalc type error when evaluating AI-generated formulas NCalc2 operates on double internally; passing decimal parameters caused 'Operator * cannot be applied to double and decimal' at runtime. Co-Authored-By: Claude Sonnet 4.6 --- .../Services/CustomFormulaAiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowderCoating.Infrastructure/Services/CustomFormulaAiService.cs b/src/PowderCoating.Infrastructure/Services/CustomFormulaAiService.cs index 0420d95..ce733e4 100644 --- a/src/PowderCoating.Infrastructure/Services/CustomFormulaAiService.cs +++ b/src/PowderCoating.Infrastructure/Services/CustomFormulaAiService.cs @@ -181,7 +181,7 @@ Rules: foreach (var kv in variables) { expr.Parameters[kv.Key] = kv.Value.ValueKind == JsonValueKind.Number - ? (object)kv.Value.GetDecimal() + ? (object)kv.Value.GetDouble() : (object)(kv.Value.GetString() ?? ""); }