Skip to content

Commit 37f1d1e

Browse files
authored
Merge pull request projecthorus#3 from projecthorus/feature/set-position-id
Send position id to backend so we don't download the entire datanew each time
2 parents 9de593e + a559d85 commit 37f1d1e

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ function trackerInit() {
243243
if(wvar.graph) $('#telemetry_graph').attr('style','');
244244

245245
// fetch hysplit jobs
246-
setInterval(refresh_hysplit, 60 * 1000);
247-
refresh_hysplit();
246+
// setInterval(refresh_hysplit, 60 * 1000);
247+
// refresh_hysplit();
248248

249249
return;
250250
}

js/tracker.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ var mapInfoBox_handle_path_fetch = function(id,vehicle) {
14731473
html += "<img style='position:absolute;top:"+vehicle.image_src_offset.y+"px;left:"+vehicle.image_src_offset.x+"px;" +
14741474
"width:"+vehicle.image_src_size.width+"px;height:"+vehicle.image_src_size.height+"px'" +
14751475
" src='"+vehicle.image_src+"' />";
1476-
html += "<div>"+data.vehicle+"<span style='position:absolute;right:0px;'>("+data.position_id+")</span></div>";
1476+
html += "<div>"+data.vehicle+"<span style=''>("+data.position_id+")</span></div>";
14771477
html += "<hr style='margin:5px 0px'>";
14781478
html += "<div style='margin-bottom:5px;'><b><i class='icon-location'></i>&nbsp;</b>"+roundNumber(data.gps_lat, 5) + ',&nbsp;' + roundNumber(data.gps_lon, 5)+"</div>";
14791479

@@ -1504,7 +1504,30 @@ var mapInfoBox_handle_path_fetch = function(id,vehicle) {
15041504

15051505
if(data.vehicle.search(/(chase)/i) == -1) {
15061506
html += "<hr style='margin:0px;margin-top:5px'>";
1507-
html += "<div style='font-size:11px;'><b>Received via:&nbsp;</b>"+data.callsign.replace(/,/g,', ')+"</div>";
1507+
html += "<div style='font-size:11px;'>"
1508+
var callsign_list = []
1509+
for(var rxcall in data.callsign){
1510+
if(data.callsign.hasOwnProperty(rxcall)) {
1511+
_new_call += "<b>Received via:&nbsp;</b> ";
1512+
_new_call = rxcall;
1513+
if(data.callsign[rxcall].hasOwnProperty('snr')){
1514+
if(data.callsign[rxcall].snr){
1515+
_new_call += " (" + data.callsign[rxcall].snr.toFixed(0) + " dB)";
1516+
callsign_list.push(_new_call)
1517+
continue;
1518+
}
1519+
}
1520+
if(data.callsign[rxcall].hasOwnProperty('rssi')){
1521+
if(data.callsign[rxcall].rssi){
1522+
_new_call += " (" + data.callsign[rxcall].snr.toFixed(0) + " dBm)";
1523+
callsign_list.push(_new_call)
1524+
continue;
1525+
}
1526+
}
1527+
}
1528+
}
1529+
callsign_list = callsign_list.join("<br /> ");
1530+
html += callsign_list + "</div>";
15081531
}
15091532

15101533
div.innerHTML = html;
@@ -2972,7 +2995,14 @@ function update(response) {
29722995
for (; i < max ; i++) {
29732996
var row = ctx.positions[i];
29742997

2975-
if(row.position_id > position_id) { position_id = row.position_id; }
2998+
// set the position based on the last record (oldest) returned from the server. Only provide minute accuracy to allow better hit rate with cloudfront
2999+
this_position_id = new Date(row.gps_time);
3000+
this_position_id.setSeconds(0)
3001+
this_position_id.setMilliseconds(0)
3002+
3003+
if (new Date(position_id) < this_position_id || position_id == 0){
3004+
position_id = this_position_id.toISOString()
3005+
}
29763006

29773007
if (!row.picture) {
29783008
addPosition(row);

0 commit comments

Comments
 (0)