mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Check both created_at and timestamp fields for treatments in if-modified-since logic
This commit is contained in:
@@ -40,8 +40,18 @@ function configure(app, wares, ctx) {
|
||||
t.carbs = Number(t.carbs);
|
||||
t.insulin = Number(t.insulin);
|
||||
|
||||
var d2 = new Date(t.timestamp);
|
||||
var d2 = null;
|
||||
|
||||
if (t.hasOwnProperty('created_at')) {
|
||||
d2 = new Date(t.created_at);
|
||||
} else {
|
||||
if (t.hasOwnProperty('timestamp')) {
|
||||
d2 = new Date(t.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (d2 == null) { return; }
|
||||
|
||||
if (d1 == null || d2.getTime() > d1.getTime()) {
|
||||
d1 = d2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user