diff --git a/providers/alert/hamsat.py b/providers/alert/hamsat.py index d04302f..6390e2a 100644 --- a/providers/alert/hamsat.py +++ b/providers/alert/hamsat.py @@ -22,11 +22,18 @@ class Hamsat(HTTPAlertProvider): # Iterate through source data for source_alert in http_response.json()["data"]: # Convert to our alert format + freqs_modes = source_alert.get("mode", "") + if "mhz" in source_alert: + if "mhz_direction" in source_alert: + freqs_modes = f"{source_alert['mhz']!s} {source_alert['mhz_direction']}, {freqs_modes}" + else: + freqs_modes = f"{source_alert['mhz']!s}, {freqs_modes}" + alert = Alert( source=self.name, source_id=source_alert["id"], dx_calls=[source_alert["callsign"].upper()], - freqs_modes=f"{source_alert['mhz']!s} {source_alert['mhz_direction']}, {source_alert['mode']}", + freqs_modes=freqs_modes, comment=source_alert["comment"], # Fudge a SIG ref to provide the remaining bits of data we need: the satellite and the operator's grid sig_refs=[ diff --git a/static/js/alerts.js b/static/js/alerts.js index 2c71454..ffd5a0e 100644 --- a/static/js/alerts.js +++ b/static/js/alerts.js @@ -54,7 +54,7 @@ function updateTable() { const showDX = $("#tableShowDX")[0].checked; const showFreqsModes = $("#tableShowFreqsModes")[0].checked; const showComment = $("#tableShowComment")[0].checked; - const showSource = $("#tableShowSource")[0].checked; + const showType = $("#tableShowType")[0].checked; const showRef = $("#tableShowRef")[0].checked; // Populate table with headers @@ -75,8 +75,8 @@ function updateTable() { if (showComment) { table.find('thead tr').append(`
`); } - if (showSource) { - table.find('thead tr').append(``); + if (showType) { + table.find('thead tr').append(``); } if (showRef) { table.find('thead tr').append(``); @@ -151,7 +151,7 @@ function addAlertRowsToTable(tbody, alerts) { const showDX = $("#tableShowDX")[0].checked; const showFreqsModes = $("#tableShowFreqsModes")[0].checked; const showComment = $("#tableShowComment")[0].checked; - const showSource = $("#tableShowSource")[0].checked; + const showType = $("#tableShowType")[0].checked; const showRef = $("#tableShowRef")[0].checked; // Get times for the alert, and convert to local time if necessary. @@ -232,14 +232,38 @@ function addAlertRowsToTable(tbody, alerts) { if (a["comment"] != null) { commentText = escapeHtml(a["comment"]); } - if (a["url"] != null) { - commentText += ` 🔗`; + + // Format extra text, like URL and attribution + let subComment = a["url"] != null || a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar"; + if (subComment) { + let subCommentText = "" + if (a["url"] != null) { + subCommentText += `More info`; + } + if ((a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar")) { + if (subCommentText !== "") { + subCommentText += " | "; + } + subCommentText += `From ${a["source"]}`; + } + commentText += `