From 04435e770a40b971bdaf29d6ca1c8524b009a12a Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Fri, 31 Oct 2025 17:33:27 +0000 Subject: [PATCH] Add dx_call_includes filter --- server/webserver.py | 6 ++++++ webassets/apidocs/openapi.yml | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/server/webserver.py b/server/webserver.py index f57159f..5f86e74 100644 --- a/server/webserver.py +++ b/server/webserver.py @@ -246,6 +246,9 @@ class WebServer: case "comment_includes": comment_includes = query.get(k).strip() spots = [s for s in spots if s.comment and comment_includes.upper() in s.comment.upper()] + case "dx_call_includes": + dx_call_includes = query.get(k).strip() + spots = [s for s in spots if s.dx_call and dx_call_includes.upper() in s.dx_call.upper()] case "allow_qrt": # If false, spots that are flagged as QRT are not returned. prevent_qrt = query.get(k).upper() == "FALSE" @@ -320,6 +323,9 @@ class WebServer: case "dx_continent": dxconts = query.get(k).split(",") alerts = [a for a in alerts if a.dx_continent and a.dx_continent in dxconts] + case "dx_call_includes": + dx_call_includes = query.get(k).strip() + spots = [a for a in alerts if a.dx_call and dx_call_includes.upper() in a.dx_call.upper()] # If we have a "limit" parameter, we apply that last, regardless of where it appeared in the list of keys. if "limit" in query.keys(): alerts = alerts[:int(query.get("limit"))] diff --git a/webassets/apidocs/openapi.yml b/webassets/apidocs/openapi.yml index 31498c9..44858ac 100644 --- a/webassets/apidocs/openapi.yml +++ b/webassets/apidocs/openapi.yml @@ -207,6 +207,12 @@ paths: schema: type: boolean default: false + - name: dx_call_includes + in: query + description: "Limit the alerts to only ones where the DX callsign includes the supplied string (case-insensitive). Generally a complete callsign, but you can supply a shorter string for partial matches." + required: false + schema: + type: string - name: comment_includes in: query description: "Return only spots where the comment includes the provided string (case-insensitive)." @@ -317,7 +323,7 @@ paths: - WAI - name: dx_continent in: query - description: "Limit the alerts to only ones where the DX (the operator being spotted) is on the given continent(s). To select more than one continent, supply a comma-separated list." + description: "Limit the alerts to only ones where the DX operator is on the given continent(s). To select more than one continent, supply a comma-separated list." required: false schema: type: string @@ -329,6 +335,12 @@ paths: - AF - OC - AN + - name: dx_call_includes + in: query + description: "Limit the alerts to only ones where the DX callsign includes the supplied string (case-insensitive). Generally a complete callsign, but you can supply a shorter string for partial matches." + required: false + schema: + type: string responses: '200': description: Success