Commit bb509317 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

search: more flexible superevent ID queries

Things like 's190418BC' will work now (should be 'S190418bc')
parent a8c927cc
......@@ -37,6 +37,12 @@ def parse_superevent_id(name, toks, filter_prefix=None):
if (toks.prefix == Superevent.GW_ID_PREFIX):
toks.suffix = toks.suffix.upper()
# Allow flexible suffix capitalization
if (toks.prefix == Superevent.GW_ID_PREFIX):
toks.suffix = toks.suffix.upper()
else:
toks.suffix = toks.suffix.lower()
# Combine into full ID and get lookup kwargs
s_id = toks.preprefix + toks.prefix + toks.date + toks.suffix
f_kwargs = Superevent.get_filter_kwargs_for_date_id_lookup(s_id)
......
......@@ -43,6 +43,10 @@ SUPEREVENT_QUERY_TEST_DATA = [
("", DEFAULT_Q),
("id: S190509bc",
Q(**Superevent.get_filter_kwargs_for_date_id_lookup("S190509bc"))),
("id: Tgw190331eBz",
Q(**Superevent.get_filter_kwargs_for_date_id_lookup("TGW190331EBZ"))),
("id: ms190331BCdE",
Q(**Superevent.get_filter_kwargs_for_date_id_lookup("MS190331bcde"))),
("superevent_id: S190509bc",
Q(**Superevent.get_filter_kwargs_for_date_id_lookup("S190509bc"))),
("S190509bc",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment