Review status logic to be moved to backend #1987
Labels
enhancement
New feature or request
help wanted
Extra attention is needed
javascript
Pull requests that update Javascript code
Overview of the issue
The UI currently handles the logic for determining the status of reviews based on the responses to said review, which has a number of concerns:
For each review, the UI currently iterates over each review response list, finds the latest response for each unique reviewer, then determines the status by seeing if they're either all approved, or if any of the latest responses are requesting changes (this will override any other approvals by different reviewers). Whilst this works, we should really be returning this information via the API.
Proposed solutuons
Adding a new property to the review model solves this, but we should be careful about this is done. We should avoid calculating this when responses are saved, as we shouldn't need to store this information in the database. Instead, we should either:
This latter of the two options will be slightly more complex to implement, but should, in theory, be far more efficient.
Ultimately, the current logic remains the same, and the UI should behave exactly like it is now, with the added benefit of less confusing logic in the frontend code, and a much easier way of retrieving the state of a review.
The text was updated successfully, but these errors were encountered: