Skip to content

Commit

Permalink
fix(backend): review state for received on submission table (#2101)
Browse files Browse the repository at this point in the history
* fix(submission): fix review state filter for received

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Anuj-Gupta4 and pre-commit-ci[bot] authored Jan 22, 2025
1 parent 2b1db38 commit 2a81bdf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/app/submissions/submission_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async def submission_table(
"and __system/submissionDate le {}T23:59:59.999+00:00"
).format(start_date, end_date)

if review_state:
if review_state and review_state != "received":
review_filter = f"__system/reviewState eq '{review_state}'"
filters["$filter"] = (
f"{filters['$filter']} and {review_filter}"
Expand All @@ -314,6 +314,12 @@ async def submission_table(
data = await submission_crud.get_submission_by_project(project, filters)
total_count = data.get("@odata.count", 0)
submissions = data.get("value", [])
if review_state == "received":
submissions = [
sub for sub in submissions if sub["__system"].get("reviewState") is None
]
total_count = len(submissions)

instance_ids = [
sub["__id"]
for sub in submissions
Expand Down

0 comments on commit 2a81bdf

Please sign in to comment.