Only show riders when tracking timestamp is newer than 3 hours ago
This commit is contained in:
parent
a8c0aefbd6
commit
0cb10203c7
6
main.js
6
main.js
|
@ -245,6 +245,11 @@ async function main() {
|
|||
map.addOverlay(overlayElement);
|
||||
}
|
||||
|
||||
function isRecentTimestamp (tst) {
|
||||
// newer than 2 hours ago?
|
||||
return (tst * 1000) > (Date.now() - 2*60*60*1000);
|
||||
}
|
||||
|
||||
function updateData(startInterval=false) {
|
||||
fetch('https://r2b22.kip.pe/last.json')
|
||||
.then(response => response.json())
|
||||
|
@ -255,6 +260,7 @@ async function main() {
|
|||
|
||||
for (const item of data) {
|
||||
if (!tourStatus.participants.includes(item.name)) continue;
|
||||
if (!isRecentTimestamp(item.tst)) continue;
|
||||
createParticipantHTML(item.name);
|
||||
createParticipantOverlay(item.name);
|
||||
const overlay = peopleOverlays[item.name];
|
||||
|
|
Loading…
Reference in New Issue