From e4e611906581b2673e7d3d841d09317a2985bde3 Mon Sep 17 00:00:00 2001 From: Jeff Steward Date: Mon, 3 Aug 2020 09:18:09 -0400 Subject: [PATCH] improve number formatting --- routes/index.js | 4 ++++ views/production.hbs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/routes/index.js b/routes/index.js index ac90727..88aa0b6 100644 --- a/routes/index.js +++ b/routes/index.js @@ -50,14 +50,18 @@ router.get('/', function(req, res, next) { data.dateoflastrefresh = results['objectStats']['lastrefresh']; data.dateoflastexport = results['objectStats']['lastexport']; data.objects.count = results['objectStats']['recordcount']; + data.objects.count_as_string = data.objects.count.toLocaleString('en'); data.objects.public.count = results['objectStats']['recordcount_public']; + data.objects.public.count_as_string = data.objects.public.count.toLocaleString('en'); data.objects.public.count_as_percent = ((results['objectStats']['recordcount_public']/results['objectStats']['recordcount'])*100).toFixed(2); data.objects.onview.count = results['objectsOnViewStats']; + data.objects.onview.count_as_string = data.objects.onview.count.toLocaleString('en'); data.objects.onview.count_as_percent = ((results['objectsOnViewStats']/results['objectStats']['recordcount'])*100).toFixed(2); data.exhibitions.current = results['currentExhibitions']; data.objects.alttext.count = results['alttextStats']; data.objects.alttext.count_as_percent = ((data.objects.alttext.count/data.objects.count)*100).toFixed(2); data.pageviews = results['activityStats']['pageviews']; + data.pageviews.objects.count_as_string = data.pageviews.objects.count.toLocaleString('en'); data.pageviews.objects.count_as_percent = ((data.pageviews.objects.count/data.objects.public.count)*100).toFixed(2) // calculate the age of the data diff --git a/views/production.hbs b/views/production.hbs index f33d893..04ceef8 100644 --- a/views/production.hbs +++ b/views/production.hbs @@ -20,9 +20,9 @@

{{apistats.objects.onview.count_as_percent}}% of the collection is on view in galleries.

@@ -44,7 +44,7 @@

Website Statistics*

-

{{apistats.pageviews.objects.count}} individual objects have been viewed on our website to date. That's {{apistats.pageviews.objects.count_as_percent}}% of the collection.

+

{{apistats.pageviews.objects.count_as_string}} individual objects have been viewed on our website to date. That's {{apistats.pageviews.objects.count_as_percent}}% of the collection.

The object with the most views in a single day: