Fix multi callsign alerts from NG3K #38

This commit is contained in:
Ian Renton
2025-10-11 20:21:52 +01:00
parent cc816d8662
commit 3ed9b95b9b
2 changed files with 12 additions and 8 deletions

View File

@@ -53,14 +53,13 @@ class NG3K(HTTPAlertProvider):
# Sometimes the DX callsign is "real", sometimes you just get a prefix with the real working callsigns being # Sometimes the DX callsign is "real", sometimes you just get a prefix with the real working callsigns being
# provided in the "by" field. e.g. call="JW", by="By LA7XK as JW7XK, LA6VM as JW6VM, LA9DL as JW9DL". So # provided in the "by" field. e.g. call="JW", by="By LA7XK as JW7XK, LA6VM as JW6VM, LA9DL as JW9DL". So
# if there are "as" callsigns in the "by" field, we extract them and replace the main call with them. # if there are "as" callsigns in the "by" field, we extract them and use them, otherwise we fall back to the
# TODO this doesn't work yet, debug # "real" call field.
extra_parts = parts[5].split("; ") extra_parts = parts[5].split("; ")
by = extra_parts[0] by = extra_parts[0]
dx_calls = [parts[2].upper()]
match = self.AS_CALL_PATTERN.match(by)
if match:
dx_calls = [x.group(1) for x in re.finditer(self.AS_CALL_PATTERN, by)] dx_calls = [x.group(1) for x in re.finditer(self.AS_CALL_PATTERN, by)]
if not dx_calls:
dx_calls = [parts[2].upper()]
dx_country = parts[1] dx_country = parts[1]
qsl_info = parts[3] qsl_info = parts[3]

View File

@@ -144,6 +144,12 @@ function addAlertRowsToTable(tbody, alerts) {
dx_country = "Unknown or not a country" dx_country = "Unknown or not a country"
} }
// Format dx calls
var dx_calls_html = "";
if (a["dx_calls"] != null) {
dx_calls_html = a["dx_calls"].map(call => `<a class='dx-link' href='https://qrz.com/db/${call}' target='_new'>${call}</a>`).join(", ");
}
// Format freqs & modes // Format freqs & modes
var freqsModesText = ""; var freqsModesText = "";
if (a["freqs_modes"] != null) { if (a["freqs_modes"] != null) {
@@ -171,8 +177,7 @@ function addAlertRowsToTable(tbody, alerts) {
// Populate the row // Populate the row
$tr.append(`<td class='nowrap'>${start_time_formatted}</td>`); $tr.append(`<td class='nowrap'>${start_time_formatted}</td>`);
$tr.append(`<td class='nowrap'>${end_time_formatted}</td>`); $tr.append(`<td class='nowrap'>${end_time_formatted}</td>`);
// TODO take a["dx_calls"] and add a callsign to the following td for every one in the list. $tr.append(`<td class='nowrap'><span class='flag-wrapper hideonmobile' title='${dx_country}'>${dx_flag}</span>${dx_calls_html}</td>`);
$tr.append(`<td class='nowrap'><span class='flag-wrapper hideonmobile' title='${dx_country}'>${dx_flag}</span><a class='dx-link' href='https://qrz.com/db/${call}' target='_new'>${call}</a></td>`);
$tr.append(`<td class='hideonmobile'>${freqsModesText}</td>`); $tr.append(`<td class='hideonmobile'>${freqsModesText}</td>`);
$tr.append(`<td class='hideonmobile'>${commentText}</td>`); $tr.append(`<td class='hideonmobile'>${commentText}</td>`);
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${a["icon"]}'></i></span> ${sigSourceText}</td>`); $tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${a["icon"]}'></i></span> ${sigSourceText}</td>`);