From b7d2cf0fdbb8dcfc8359c7a5d71fb8e4f53ab97d Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sat, 1 Aug 2026 09:32:16 +0100 Subject: [PATCH] Fix some bugs #118 --- core/lookup_helper.py | 2 +- core/sig_utils.py | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/core/lookup_helper.py b/core/lookup_helper.py index 0f17693..07b841a 100644 --- a/core/lookup_helper.py +++ b/core/lookup_helper.py @@ -621,7 +621,7 @@ class LookupHelper: def _get_dxcc_data_for_callsign(self, call) -> dict | None: """Utility method to get generic DXCC data from our lookup table, if we can find it""" - for entry in self._dxcc_data.values(): + for entry in [DATA_STORE.dxcc_data[key] for key in DATA_STORE.dxcc_data]: if entry["_prefixRegexCompiled"].match(call): return entry return None diff --git a/core/sig_utils.py b/core/sig_utils.py index a3ee09b..ed74d84 100644 --- a/core/sig_utils.py +++ b/core/sig_utils.py @@ -56,7 +56,7 @@ def populate_sig_ref_info(sig_ref): ### SKIPS ### # # If the SIG is HEMA, we have no current lookup for this so just skip the lookup here. - if sig.upper() == "HEMA" or sig.upper() == "KRMNPA": + if sig.upper() == "HEMA": return sig_ref ### PROGRAMMATIC DATA GENERATION INSTEAD OF LOOKUPS ### @@ -95,19 +95,15 @@ def populate_sig_ref_info(sig_ref): # # OK, this is something we have to look up. Now check to see if our data store contains SIG ref information for # this SIG. If so, check for the reference data and use that. - elif sig in DATA_STORE.sigrefs: - key = sig + ":" + ref_id - lookup_data = DATA_STORE.sigrefs.get(key) if key in DATA_STORE.sigrefs else None - if lookup_data: - # Copy new sig ref data into existing object where data was previously missing - for key, value in lookup_data.__dict__.items(): - if value is not None and sig_ref.__dict__.get(key) is None: - sig_ref.__dict__[key] = value - else: - logging.warning("%s database did not contain data for ref %s", sig, ref_id) - + key = sig + ":" + ref_id + lookup_data = DATA_STORE.sigrefs.get(key) if key in DATA_STORE.sigrefs else None + if lookup_data: + # Copy new sig ref data into existing object where data was previously missing + for key, value in lookup_data.__dict__.items(): + if value is not None and sig_ref.__dict__.get(key) is None: + sig_ref.__dict__[key] = value else: - logging.warning(f"Tried to look up a SIG called %s but Spothole does not know what that is.", sig) + logging.warning("%s database did not contain data for ref %s", sig, ref_id) except Exception: logging.error("Exception when looking up sig_ref info for " + sig + " ref " + ref_id, exc_info=True)