From 268c7cbefb41599bc9bdac9446ce3ecec8eebe35 Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Thu, 6 Feb 2025 11:26:41 -0500 Subject: [PATCH] Fix depth and last approved filter test that wasn't updated --- backend/btrixcloud/pages.py | 12 ++++-------- backend/test/test_run_crawl.py | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/backend/btrixcloud/pages.py b/backend/btrixcloud/pages.py index eccfacfd84..8082f30df6 100644 --- a/backend/btrixcloud/pages.py +++ b/backend/btrixcloud/pages.py @@ -546,10 +546,8 @@ async def list_pages( if is_seed in (True, False): query["isSeed"] = is_seed - # Check that field matches and value is an int to avoid 0 - # from returning null results - if depth: - query["$and"] = [{"depth": depth}, {"depth": {"type": 16}}] + if isinstance(depth, int): + query["depth"] = depth if reviewed: query["$or"] = [ @@ -699,10 +697,8 @@ async def list_collection_pages( if is_seed in (True, False): query["isSeed"] = is_seed - # Check that field matches and value is an int to avoid 0 - # from returning null results - if depth: - query["$and"] = [{"depth": depth}, {"depth": {"type": 16}}] + if isinstance(depth, int): + query["depth"] = depth aggregate = [{"$match": query}] diff --git a/backend/test/test_run_crawl.py b/backend/test/test_run_crawl.py index 47ba0a3e38..1482bcf830 100644 --- a/backend/test/test_run_crawl.py +++ b/backend/test/test_run_crawl.py @@ -953,7 +953,7 @@ def test_crawl_pages_qa_filters(crawler_auth_headers, default_org_id, crawler_cr headers=crawler_auth_headers, ) assert r.status_code == 200 - assert r.json()["total"] == 0 + assert r.json()["total"] == 2 def test_re_add_crawl_pages(crawler_auth_headers, default_org_id, crawler_crawl_id):