Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review status logic to be moved to backend #1987

Open
ARADDCC002 opened this issue Mar 11, 2025 · 0 comments
Open

Review status logic to be moved to backend #1987

ARADDCC002 opened this issue Mar 11, 2025 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code

Comments

@ARADDCC002
Copy link
Member

ARADDCC002 commented Mar 11, 2025

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:

  • It's more inefficient to run this on the user
  • Users only using the API will have to determine the review status out themselves manually

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:

  • Move the current logic from the frontend and add it to the backend service layer, and dynamically append this new status field to the review query, or
  • Move the logic inside a Mongo aggregate query

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.

@ARADDCC002 ARADDCC002 added enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code labels Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

1 participant