From 9340ce70b063a3cc553a6a05acbbc9a27b704e3b Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 4 Jul 2024 11:47:06 +0200 Subject: [PATCH] Bug 1906258 - make bug suggestion generation for failure case-insensitive --- tests/model/test_bugscache.py | 1 + treeherder/model/models.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/model/test_bugscache.py b/tests/model/test_bugscache.py index c35cf00a0cf..54b38d1637d 100644 --- a/tests/model/test_bugscache.py +++ b/tests/model/test_bugscache.py @@ -37,6 +37,7 @@ def _update_bugscache(bug_list): BUG_SEARCHES = ( ("test_popup_preventdefault_chrome.xul", [455091]), + ("test_Popup_Preventdefault_Chrome.XUL", [455091]), ("test_popup_preventdefault_chrome.xul foo bar", []), ( "test_switch_frame.py TestSwitchFrame.test_should_be_able_to_carry_on_working_if_the_frame_is_deleted", diff --git a/treeherder/model/models.py b/treeherder/model/models.py index 0ae779af88c..3a59e563659 100644 --- a/treeherder/model/models.py +++ b/treeherder/model/models.py @@ -234,6 +234,7 @@ def __str__(self): @classmethod def search(cls, search_term): max_size = 50 + search_term = search_term.lower() # On PostgreSQL we can use the ORM directly, but NOT the full text search # as the ranking algorithm expects english words, not paths @@ -254,11 +255,11 @@ def search(cls, search_term): all_data = [ match for match in open_recent_match_string - if match["summary"].startswith(search_term) - or "/" + search_term in match["summary"] - or " " + search_term in match["summary"] - or "\\" + search_term in match["summary"] - or "," + search_term in match["summary"] + if match["summary"].lower().startswith(search_term) + or "/" + search_term in match["summary"].lower() + or " " + search_term in match["summary"].lower() + or "\\" + search_term in match["summary"].lower() + or "," + search_term in match["summary"].lower() ] open_recent = [x for x in all_data if x["resolution"] == ""] all_others = [x for x in all_data if x["resolution"] != ""]