Commit 882f96f
authored
Merge pull request #19 from SiegfriedBz/feature/fix-cqrs-senior-reviewer-assignments-filter
fix(cqrs): apply IN_REVIEW status filter to senior reviewer assignments
# PR: Fix Senior Reviewer Assignment Filtering
## Summary
Fixed a bug where Senior Reviewers still saw finished (`PUBLISHED`) or failed (`SLASHED`) publications in their "Active Assignments" table.
## The Problem
While Peer Reviewers saw the correctly filtered list, Senior Reviewers were seeing all assignments regardless of the publication's current status.
## Root Cause
A SQL operator precedence bug in the `getMemberAssignments` function. A raw SQL template literal was used where `AND` bound more tightly than `OR`, causing the status filter to only apply to the Peer Reviewer branch.
* **Incorrect Logic:** `WHERE reviewerType = 'peer' AND status = 2 OR reviewerType = 'senior'`
* **Actual Execution:** `(Peer AND Active) OR (Senior)`
## The Fix
Refactored the query to use Drizzle ORM’s `or()` and `and()` helpers. This ensures proper parenthesization in the emitted SQL so that the status filter is applied to both reviewer types.
* **Corrected Logic:** `WHERE (reviewerType = 'peer' OR reviewerType = 'senior') AND status = 2`
## Changes
* **`getMemberAssignments`**: Swapped raw SQL for Drizzle functional syntax for better type safety and correct operator grouping.
* **Verification**: Confirmed that Senior Reviewer dashboards now correctly filter out non-active publications.1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
0 commit comments