From af7e5e4b3567a93e42e70de33e46e6e67792553a Mon Sep 17 00:00:00 2001 From: Dmitriy Alekseev <1865999+dragoangel@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:35:02 +0200 Subject: [PATCH] round scores and weight --- src/plugins/lua/elastic.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index d4a5fdf85..c1935b1f0 100644 --- a/src/plugins/lua/elastic.lua +++ b/src/plugins/lua/elastic.lua @@ -462,15 +462,21 @@ local function get_general_metadata(task) r.symbols = task:get_symbols_all() for _, symbol in ipairs(r.symbols) do symbol.groups = nil -- we don't need groups array in elastic - if type(symbol.options) == "table" then - symbol.options = table.concat(symbol.options, "; ") + if type(symbol.score) == 'number' then + symbol.score = lua_util.round(symbol.score, 3) + end + if type(symbol.weight) == 'number' then + symbol.weight = lua_util.round(symbol.weight, 3) + end + if type(symbol.options) == 'table' then + symbol.options = table.concat(symbol.options, '; ') end end r.user = user or empty if user then - r.direction = "Outbound" + r.direction = 'Outbound' else - r.direction = "Inbound" + r.direction = 'Inbound' end r.qid = task:get_queue_id() or empty r.helo = task:get_helo() or empty -- 2.39.5