Skip to content

Commit

Permalink
Add 'activeQAStats' field (#1694)
Browse files Browse the repository at this point in the history
As additional support for #1683, include the active QA stats in the
crawl response, along with active QA state.
This will allow showing progress of QA run in the archived items list.
  • Loading branch information
ikreymer authored Apr 18, 2024
1 parent 3e4b0e4 commit 9609ff4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/btrixcloud/basecrawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ async def list_all_base_crawls(
{"$unset": ["firstSeedObject", "errors", "config"]},
{"$set": {"qaState": "$qa.state"}},
{"$set": {"activeQAState": "$qaState"}},
{"$set": {"activeQAStats": "$qa.stats"}},
{
"$set": {
"qaFinishedArray": {
Expand Down
1 change: 1 addition & 0 deletions backend/btrixcloud/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ async def list_crawls(
{"$unset": ["firstSeedObject", "errors", "config"]},
{"$set": {"qaState": "$qa.state"}},
{"$set": {"activeQAState": "$qaState"}},
{"$set": {"activeQAStats": "$qa.stats"}},
{
"$set": {
"qaFinishedArray": {
Expand Down
1 change: 1 addition & 0 deletions backend/btrixcloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ class CrawlOut(BaseMongoModel):

qaRunCount: int = 0
activeQAState: Optional[str]
activeQAStats: Optional[CrawlStats]
lastQAState: Optional[str]


Expand Down
2 changes: 2 additions & 0 deletions backend/test/test_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def failed_qa_run_id(crawler_crawl_id, crawler_auth_headers, default_org_id):
crawls = r.json()["items"]
assert crawls[0]["id"] == crawler_crawl_id
assert crawls[0]["activeQAState"]
assert crawls[0]["activeQAStats"]
assert crawls[0]["lastQAState"]

# Ensure sorting by qaState works as expected with all-crawls
Expand All @@ -136,6 +137,7 @@ def failed_qa_run_id(crawler_crawl_id, crawler_auth_headers, default_org_id):
crawls = r.json()["items"]
assert crawls[0]["id"] == crawler_crawl_id
assert crawls[0]["activeQAState"]
assert crawls[0]["activeQAStats"]
assert crawls[0]["lastQAState"]

# Cancel crawl
Expand Down

0 comments on commit 9609ff4

Please sign in to comment.