mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Last Entry: out of date colored backgrounds
Adding warning + urgent colored backgrounds when BG is out of date by 10 or 20 minutes.
This commit is contained in:
@@ -59,6 +59,13 @@ body {
|
||||
color: #000;
|
||||
padding: 0.25em;
|
||||
}
|
||||
#lastEntry.warn {
|
||||
background: #cc0;
|
||||
}
|
||||
#lastEntry.urgent {
|
||||
background: #c00;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#chartContainer {
|
||||
background: #111;
|
||||
|
||||
+15
-3
@@ -1,6 +1,6 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
var retrospectivePredictor = true,
|
||||
latestSGV,
|
||||
treatments,
|
||||
@@ -31,7 +31,9 @@
|
||||
currentAlarmType = null,
|
||||
alarmSound = 'alarm.mp3',
|
||||
urgentAlarmSound = 'alarm2.mp3',
|
||||
WIDTH_TIME_HIDDEN = 600;
|
||||
WIDTH_TIME_HIDDEN = 600,
|
||||
MINUTES_SINCE_LAST_UPDATE_WARN = 10,
|
||||
MINUTES_SINCE_LAST_UPDATE_URGENT = 20;
|
||||
|
||||
// Tick Values
|
||||
var tickValues = [40, 60, 80, 120, 180, 300, 400];
|
||||
@@ -808,7 +810,7 @@
|
||||
DAY = 86400,
|
||||
WEEK = 604800;
|
||||
|
||||
if (offset <= MINUTE) parts = { lablel: 'now' };
|
||||
if (offset <= MINUTE) parts = { label: 'now' };
|
||||
if (offset <= MINUTE * 2) parts = { label: '1 min ago' };
|
||||
else if (offset < (MINUTE * 60)) parts = { value: Math.round(Math.abs(offset / MINUTE)), label: 'mins' };
|
||||
else if (offset < (HOUR * 2)) parts = { label: '1 hr ago' };
|
||||
@@ -818,6 +820,16 @@
|
||||
else if (offset < (WEEK * 52)) parts = { value: Math.round(Math.abs(offset / WEEK)), label: 'week' };
|
||||
else parts = { label: 'a long time ago' };
|
||||
|
||||
if (offset > (MINUTE * MINUTES_SINCE_LAST_UPDATE_URGENT)) {
|
||||
var lastEntry = $("#lastEntry");
|
||||
lastEntry.removeClass("warn");
|
||||
lastEntry.addClass("urgent");
|
||||
} else if (offset > (MINUTE * MINUTES_SINCE_LAST_UPDATE_WARN)) {
|
||||
var lastEntry = $("#lastEntry");
|
||||
lastEntry.removeClass("urgent");
|
||||
lastEntry.addClass("warn");
|
||||
}
|
||||
|
||||
if (parts.value)
|
||||
return parts.value + ' ' + parts.label + ' ago';
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user