aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-05-13 15:24:25 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-05-13 15:24:25 +0100
commitd932fb8f52b7e9e3226fc482329b471a5c27622a (patch)
tree35d84bf0b6a273ea6ae6b1ba00a7d02236d25347 /lualib/rspamadm
parentce61fee9d25cc3ff647860fe646dc3af1ba17f0d (diff)
downloadrspamd-d932fb8f52b7e9e3226fc482329b471a5c27622a.tar.gz
rspamd-d932fb8f52b7e9e3226fc482329b471a5c27622a.zip
[Minor] Show percentages
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/fuzzy_stat.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/lualib/rspamadm/fuzzy_stat.lua b/lualib/rspamadm/fuzzy_stat.lua
index 85af32d28..d0c14d213 100644
--- a/lualib/rspamadm/fuzzy_stat.lua
+++ b/lualib/rspamadm/fuzzy_stat.lua
@@ -78,11 +78,21 @@ local function print_stat(st, tabs)
end
end
if st['matched'] then
- if st.matched_per_hour then
- print(string.format('%sMatched: %s (%s per hour in average)', tabs,
- print_num(st['matched']), print_num(st['matched_per_hour'])))
+ if st.checked and st.checked > 0 and st.checked <= st.matched then
+ local percentage = st.matched / st.checked * 100.0
+ if st.matched_per_hour then
+ print(string.format('%sMatched: %s - %s percent (%s per hour in average)', tabs,
+ print_num(st['matched']), percentage, print_num(st['matched_per_hour'])))
+ else
+ print(string.format('%sMatched: %s - %s percent', tabs, print_num(st['matched']), percentage))
+ end
else
- print(string.format('%sMatched: %s', tabs, print_num(st['matched'])))
+ if st.matched_per_hour then
+ print(string.format('%sMatched: %s (%s per hour in average)', tabs,
+ print_num(st['matched']), print_num(st['matched_per_hour'])))
+ else
+ print(string.format('%sMatched: %s', tabs, print_num(st['matched'])))
+ end
end
end
if st['errors'] then