Bugfix for history that does not span 24h

This commit is contained in:
Paulus Schoutsen 2015-06-16 00:53:36 -07:00
parent 9fd850bf36
commit 8bb2ba2181
3 changed files with 27 additions and 9 deletions

View file

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "a6643dc82e02ec14b6c1b662f1aab661"
VERSION = "8bb96a595e6f289fcfff343778765b42"

View file

@ -23253,6 +23253,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
dataTable.addRow([entityDisplay, stateStr, start, end]);
};
var startTime = new Date(stateHistory.map(function(stateInfo) {
return stateInfo[0].lastChangedAsDate;
}).reduce(function(prev, cur) {
return Math.min(prev, cur);
}, new Date()));
// end time is Math.min(curTime, start time + 1 day)
var endTime = new Date(startTime);
endTime.setDate(endTime.getDate()+1);
if (endTime > new Date()) {
endTime = new Date();
}
var numTimelines = 0;
// stateHistory is a list of lists of sorted state objects
stateHistory.forEach(function(stateInfo) {
@ -23275,10 +23288,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
});
// end time is start time + 1 day
var endTime = new Date(stateInfo[0].lastChangedAsDate);
endTime.setDate(endTime.getDate()+1);
addRow(entityDisplay, prevState, prevLastChanged, endTime);
numTimelines++;
}.bind(this));

View file

@ -64,6 +64,19 @@
dataTable.addRow([entityDisplay, stateStr, start, end]);
};
var startTime = new Date(stateHistory.map(function(stateInfo) {
return stateInfo[0].lastChangedAsDate;
}).reduce(function(prev, cur) {
return Math.min(prev, cur);
}, new Date()));
// end time is Math.min(curTime, start time + 1 day)
var endTime = new Date(startTime);
endTime.setDate(endTime.getDate()+1);
if (endTime > new Date()) {
endTime = new Date();
}
var numTimelines = 0;
// stateHistory is a list of lists of sorted state objects
stateHistory.forEach(function(stateInfo) {
@ -86,10 +99,6 @@
}
});
// end time is start time + 1 day
var endTime = new Date(stateInfo[0].lastChangedAsDate);
endTime.setDate(endTime.getDate()+1);
addRow(entityDisplay, prevState, prevLastChanged, endTime);
numTimelines++;
}.bind(this));