This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bbc470  Use 123k4 or 123k rather than 123k+
4bbc470 is described below

commit 4bbc470aab8623512f1d932e843154ec558b8648
Author: Sebb <[email protected]>
AuthorDate: Thu Oct 7 11:18:29 2021 +0100

    Use 123k4 or 123k rather than 123k+
    
    This fixes #78
---
 webui/js/ponymail.js                | 6 ++++--
 webui/js/source/sidebar-calendar.js | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 283f985..bf5247a 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -4018,9 +4018,11 @@ function renderCalendar(FY, FM, LY, LM, activity = null) 
{
             } else if (activity && activity[ym]) {
                 let count = activity[ym];
                 if (count >= 1000) {
-                    count = Math.floor(count/1000.0) + "k+";
+                    count = Math.round(count/100.0); // nearest century
+                    count = Math.floor(count/10) + "k" + (count % 10); // 
thousands and remainder
+                } else {
+                    count = count.toString();
                 }
-                count = count.toString();
                 mdiv.inject(new HTML('span', {title: `${activity[ym].pretty()} 
emails this month`, class: 'calendar_count'}, count));
             }
             ydiv.inject(mdiv);
diff --git a/webui/js/source/sidebar-calendar.js 
b/webui/js/source/sidebar-calendar.js
index e54df16..fa6c8e2 100644
--- a/webui/js/source/sidebar-calendar.js
+++ b/webui/js/source/sidebar-calendar.js
@@ -92,9 +92,11 @@ function renderCalendar(FY, FM, LY, LM, activity = null) {
             } else if (activity && activity[ym]) {
                 let count = activity[ym];
                 if (count >= 1000) {
-                    count = Math.floor(count/1000.0) + "k+";
+                    count = Math.round(count/100.0); // nearest century
+                    count = Math.floor(count/10) + "k" + (count % 10); // 
thousands and remainder
+                } else {
+                    count = count.toString();
                 }
-                count = count.toString();
                 mdiv.inject(new HTML('span', {title: `${activity[ym].pretty()} 
emails this month`, class: 'calendar_count'}, count));
             }
             ydiv.inject(mdiv);

Reply via email to