From cbc4fa4cee05aed529db24daf739c9a73c6f6aa6 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 31 Dec 2015 10:51:42 -0800 Subject: [PATCH] Add per-hour event counts. --- static/babystats.css | 4 ++++ static/babystats.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/static/babystats.css b/static/babystats.css index 7eae562..187cc15 100644 --- a/static/babystats.css +++ b/static/babystats.css @@ -215,6 +215,7 @@ babyStatsDisplayEventCountSpacer { babyStatsDisplayEventCountHeaderTitle { display: table-cell; padding: 4px; + text-align: center; color: rgb(138,155,15); font-weight: bold; border-left: 1px solid rgb(233,127,2); @@ -228,6 +229,7 @@ babyStatsDisplayEventCountTitle { display: table-cell; padding: 4px; text-align: right; + vertical-align: middle; color: rgb(73,10,61); font-weight: bold; border-top: 1px solid rgb(233,127,2); @@ -237,7 +239,9 @@ babyStatsDisplayEventCountValue { display: table-cell; padding: 4px; text-align: center; + vertical-align: middle; color: rgb(189,21,80); border-top: 1px solid rgb(233,127,2); border-left: 1px solid rgb(233,127,2); + white-space: pre-line; } diff --git a/static/babystats.js b/static/babystats.js index 63929d0..0c0762e 100644 --- a/static/babystats.js +++ b/static/babystats.js @@ -795,8 +795,10 @@ BabyStats.prototype.updateDisplayPage_ = function() { }.bind(this)); cutoffs.forEach(function(cutoff, i) { + var hours = cutoff[1] / (60 * 60); + var perHour = Math.round((counts[i] / hours) * 100) / 100; this.displayEventCountCells_[tile.type][cutoff[0]].textContent = - counts[i]; + counts[i] + '\n(' + perHour + '/hour)'; }.bind(this)); }.bind(this)); };