]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix WebUI symbols frequency column sorting
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 17 Jan 2026 16:27:44 +0000 (19:27 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 17 Jan 2026 16:27:44 +0000 (19:27 +0300)
Previously, frequency values with exponential notation (e.g., "0.00e-5",
"389.40e-5") were compared as strings, causing incorrect sort order.

interface/js/app/symbols.js

index 576547b75e71f3b8df2bc5d7b34a0820b07b56d9..c6fe74240e351fdf2a74ffd326f1b44df2c2255d 100644 (file)
@@ -92,13 +92,11 @@ define(["jquery", "app/common", "footable"],
                 }
             }
             $.each(items, (i, item) => {
-                item.frequency = Number(item.frequency) * mult;
-
-                if (exp > 0) {
-                    item.frequency = item.frequency.toFixed(2) + "e-" + exp;
-                } else {
-                    item.frequency = item.frequency.toFixed(2);
-                }
+                const numericFreq = Number(item.frequency);
+                item.frequency = {
+                    value: (numericFreq * mult).toFixed(2) + ((exp > 0) ? "e-" + exp : ""),
+                    options: {sortValue: numericFreq}
+                };
             });
             return [items, distinct_groups];
         }
@@ -178,7 +176,7 @@ define(["jquery", "app/common", "footable"],
                             {name: "frequency",
                                 title: "Frequency",
                                 breakpoints: "md",
-                                sortValue: function (value) { return Number(value).toFixed(2); }},
+                                sortValue: (val) => val.options.sortValue},
                             {name: "time",
                                 title: "Avg. time",
                                 breakpoints: "md",