Skip to content

Commit 0beae1b

Browse files
committed
Update recovery options
1 parent 4ab70e7 commit 0beae1b

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ <h3>Payload Recovery</h3>
311311
<span><b>Under Testing - Not Yet Functional!</b></span>
312312
</div>
313313
<div class="row">
314-
<span>You can mark a sonde as recovered using the following fields. Enter the serial number (manually, as a check), tick recovered/not recovered, and add some notes. You must have location enabled and be within 5km of the radiosonde position.</span>
314+
<span>You can mark a sonde as recovered using the following fields. Enter the serial number (manually, as a check), tick recovered/not recovered, and add some notes. You must have location enabled and be within 50km of the radiosonde position.</span>
315315
</div>
316316
<div class="row">
317317
<span><b>Serial</b></span>
@@ -336,9 +336,12 @@ <h3>Payload Recovery</h3>
336336
<span class="r"><input type="text" id="pr_notes" style="width: 140px;"/></span>
337337
</div>
338338
<div class="row">
339-
<span><b>Report Success</b></span>
339+
<span><b>Report Result</b></span>
340340
<span class="r" id="pr_last_report">none</span>
341341
</div>
342+
<div class="row">
343+
<div class="g-recaptcha" data-sitekey="6LcEkBUbAAAAABTgn2lktm6UPeP0lbyqIDBBujSF"></div>
344+
</div>
342345
<div class="row">
343346
<span class="r"><input type="button" value="Submit" id="pr_submit" onclick="ChaseCar.markRecovered();"/></span>
344347
</div>
@@ -386,6 +389,7 @@ <h3>Payload Recovery</h3>
386389
</div>
387390
<!-- Was 3.31-->
388391
<script src="https://maps.google.com/maps/api/js?v=3.44&libraries=map,common,controls,util,marker,onion,kml,ga,infowindow,stats,poly,overlay,weather,weather_impl,geometry&language=en_us&key=AIzaSyCiFklq0gbg7DqUn81NqYBN17bwgK4YFf0" type="text/javascript"></script>
392+
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
389393
<script type="text/javascript" language="javascript" src="js/mobile.js"></script>
390394
<!--
391395
<script type="text/javascript" language="javascript" src="js/gmaps_extentions.js"></script>

js/chasecar.lib.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ ChaseCar.updatePosition = function(callsign, position) {
4545

4646
ChaseCar.markRecovered = function(){
4747

48-
_run_checks = false;//true;
49-
_range_limit = 5000; // Metres
48+
_run_checks = true;
49+
_range_limit = 50000; // 50 km
5050

5151
// Get the serial number to be marked recovered
5252
_serial = $("#pr_serial").val().trim();
@@ -105,19 +105,32 @@ ChaseCar.markRecovered = function(){
105105
"description": _notes
106106
};
107107

108-
console.log(_doc);
108+
// Yes this is not the right way to do this...
109+
// .. but it adds an extra bit of check.
110+
var res = grecaptcha.getResponse();
111+
if (res == "" || res == undefined || res.length == 0)
112+
{
113+
$('#pr_last_report').text("Do Recaptcha first!");
114+
return;
115+
}
109116

110117
$.ajax({
111118
type: "PUT",
112119
url: ChaseCar.recovery_uri,
113120
contentType: "application/json; charset=utf-8",
114121
dataType: "json",
115122
data: JSON.stringify(_doc),
116-
}).done(function() {
123+
}).done(function(data) {
124+
console.log(data);
117125
$('#pr_last_report').text("Reported OK!");
118126
})
119-
.fail(function() {
120-
$('#pr_last_report').text("Failed to report.");
127+
.fail(function(jqXHR, textStatus, error) {
128+
try {
129+
_fail_resp = JSON.parse(jqXHR.responseText);
130+
$('#pr_last_report').text(_fail_resp.message);
131+
} catch(err) {
132+
$('#pr_last_report').text("Failed to report.");
133+
}
121134
})
122135

123136
}

js/tracker.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var position_id = 0;
33
var data_url = "https://api.v2.sondehub.org/datanew";
44
var receivers_url = "https://api.v2.sondehub.org/listeners";
55
var predictions_url = "https://api.v2.sondehub.org/predictions?vehicles=";
6-
var recovered_sondes_url = "https://api.v2.sondehub.org/recoveries";
6+
var recovered_sondes_url = "https://api.v2.sondehub.org/recovered";
77

88
var habitat_max = 400;
99
//var habitat_url = "//habitat.habhub.org/habitat/";
@@ -2574,9 +2574,6 @@ function refreshRecoveries() {
25742574
// TODO: Option to hide recoveries
25752575
if(offline.get('opt_hide_recoveries')) return;
25762576

2577-
// API not ready yet!
2578-
return;
2579-
25802577
$.ajax({
25812578
type: "GET",
25822579
url: recovered_sondes_url,

0 commit comments

Comments
 (0)