Skip to content

Commit 2cf6287

Browse files
author
Michaela
committed
Add position_id
1 parent 9de593e commit 2cf6287

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

js/tracker.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2972,7 +2972,14 @@ function update(response) {
29722972
for (; i < max ; i++) {
29732973
var row = ctx.positions[i];
29742974

2975-
if(row.position_id > position_id) { position_id = row.position_id; }
2975+
// set the position based on the last record (oldest) returned from the server. Only provide minute accuracy to allow better hit rate with cloudfront
2976+
this_position_id = new Date(row.gps_time);
2977+
this_position_id.setSeconds(0)
2978+
this_position_id.setMilliseconds(0)
2979+
2980+
if (new Date(position_id) < this_position_id || position_id == 0){
2981+
position_id = this_position_id.toISOString()
2982+
}
29762983

29772984
if (!row.picture) {
29782985
addPosition(row);

0 commit comments

Comments
 (0)