mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-12-15 16:43:38 +00:00
Allow adding the DX grid when spotting #71
This commit is contained in:
@@ -165,9 +165,16 @@ class WebServer:
|
|||||||
response.status = 422
|
response.status = 422
|
||||||
return json.dumps("Error - Frequency of " + str(spot.freq / 1000.0) + "kHz is not in a known band.", default=serialize_everything)
|
return json.dumps("Error - Frequency of " + str(spot.freq / 1000.0) + "kHz is not in a known band.", default=serialize_everything)
|
||||||
|
|
||||||
|
# Reject if grid formatting incorrect
|
||||||
|
if spot.dx_grid and not re.match(r"^([A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}|[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}|[A-R]{2}[0-9]{2}[A-X]{2}|[A-R]{2}[0-9]{2})$", spot.dx_grid.upper()):
|
||||||
|
response.content_type = 'application/json'
|
||||||
|
response.status = 422
|
||||||
|
return json.dumps("Error - '" + spot.dx_grid + "' does not look like a valid Maidenhead grid.", default=serialize_everything)
|
||||||
|
|
||||||
# infer missing data, and add it to our database.
|
# infer missing data, and add it to our database.
|
||||||
spot.source = "API"
|
spot.source = "API"
|
||||||
spot.icon = "desktop"
|
if not spot.sig:
|
||||||
|
spot.icon = "desktop"
|
||||||
spot.infer_missing()
|
spot.infer_missing()
|
||||||
self.spots.add(spot.id, spot, expire=MAX_SPOT_AGE)
|
self.spots.add(spot.id, spot, expire=MAX_SPOT_AGE)
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,11 @@
|
|||||||
<input type="text" class="form-control" id="mode" placeholder="SSB" style="max-width: 6em;">
|
<input type="text" class="form-control" id="mode" placeholder="SSB" style="max-width: 6em;">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<label for="comment" class="form-label">Comment</label>
|
<label for="dx-grid" class="form-label">DX Grid (Optional)</label>
|
||||||
|
<input type="text" class="form-control" id="dx-grid" placeholder="AA00aa" style="max-width: 8em;">
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<label for="comment" class="form-label">Comment (Optional)</label>
|
||||||
<input type="text" class="form-control" id="comment" placeholder="59 TNX QSO 73" style="max-width: 12em;">
|
<input type="text" class="form-control" id="comment" placeholder="59 TNX QSO 73" style="max-width: 12em;">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ function addSpot() {
|
|||||||
var dx = $("#dx-call").val().toUpperCase();
|
var dx = $("#dx-call").val().toUpperCase();
|
||||||
var freqStr = $("#freq").val();
|
var freqStr = $("#freq").val();
|
||||||
var mode = $("#mode").val().toUpperCase();
|
var mode = $("#mode").val().toUpperCase();
|
||||||
|
var dxGrid = $("#dx-grid").val();
|
||||||
var comment = $("#comment").val();
|
var comment = $("#comment").val();
|
||||||
var de = $("#de-call").val().toUpperCase();
|
var de = $("#de-call").val().toUpperCase();
|
||||||
|
|
||||||
@@ -27,11 +28,17 @@ function addSpot() {
|
|||||||
if (mode != "") {
|
if (mode != "") {
|
||||||
spot["mode"] = mode;
|
spot["mode"] = mode;
|
||||||
}
|
}
|
||||||
|
if (dxGrid != "") {
|
||||||
|
spot["dx_grid"] = dxGrid;
|
||||||
|
}
|
||||||
if (comment != "") {
|
if (comment != "") {
|
||||||
spot["comment"] = comment;
|
spot["comment"] = comment;
|
||||||
}
|
}
|
||||||
if (de != "") {
|
if (de != "") {
|
||||||
spot["de_call"] = de;
|
spot["de_call"] = de;
|
||||||
|
} else {
|
||||||
|
showAddSpotError("A spotter callsign is required in order to spot.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
spot["time"] = moment.utc().valueOf() / 1000.0;
|
spot["time"] = moment.utc().valueOf() / 1000.0;
|
||||||
|
|
||||||
@@ -42,6 +49,7 @@ function addSpot() {
|
|||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
success: async function (result) {
|
success: async function (result) {
|
||||||
$("#result-good").html("<button type='button' class='btn btn-success' style='margin-top: 2em;'><i class='fa-solid fa-check'></i> OK</button>");
|
$("#result-good").html("<button type='button' class='btn btn-success' style='margin-top: 2em;'><i class='fa-solid fa-check'></i> OK</button>");
|
||||||
|
$("#result-bad").html("");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$("#result-good").hide();
|
$("#result-good").hide();
|
||||||
window.location.replace("/");
|
window.location.replace("/");
|
||||||
|
|||||||
Reference in New Issue
Block a user