diff --git a/owrx/controllers/services.py b/owrx/controllers/services.py index d485bee7..1001d6e5 100644 --- a/owrx/controllers/services.py +++ b/owrx/controllers/services.py @@ -37,8 +37,12 @@ class ServiceController(AuthorizationMixin, WebpageController): @staticmethod def renderService(c): # Choose units based on frequency + mode = c["mode"] freq = c["freq"] - if freq >= 1000000000: + if freq is None: + freq = "" + unit = "" + elif freq >= 1000000000: freq = freq / 1000000000 unit = "GHz" elif freq >= 30000000: @@ -49,9 +53,10 @@ class ServiceController(AuthorizationMixin, WebpageController): unit = "kHz" else: unit = "Hz" - # Removing trailing zeros + # Removing trailing zeros, converting mode to upper case freq = re.sub(r"\.?0+$", "", "{0}".format(freq)) + mode = "???" if mode is None else mode.upper() # Format row return "{0}{1} {2}{3}{4}".format( - c["mode"].upper(), c["sdr"], c["band"], freq, unit + mode, c["sdr"], c["band"], freq, unit )