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

Feat/review with submission #459

Merged
merged 2 commits into from
Feb 27, 2025
Merged

Feat/review with submission #459

merged 2 commits into from
Feb 27, 2025

Conversation

PGijsbers
Copy link
Collaborator

@PGijsbers PGijsbers commented Feb 26, 2025

Change

When retrieving a submission by ID its reviews will also be returned.
I abstained from also adding it to the listing endpoint which returns multiple submissions.
I figured the main purpose for those calls is to find submissions which need a review, so it felt unnecessary.
We can easily add it later if it turns out to be used in use cases where people want the review too.

How to Test

A new unit test is introduced that covers this.
To test it manually, process an asset through the review pipeline, and then request the submission using the submissions/v1/{identifier} endpoint.

Checklist

  • Tests have been added or updated to reflect the changes, or their absence is explicitly explained.
  • Documentation has been added or updated to reflect the changes, or their absence is explicitly explained. -> Documentation is auto-generated. Doesn't seem to warrant a mention in the general docs.
  • A self-review has been conducted checking:
    • No unintended changes have been committed.
    • The changes in isolation seem reasonable.
    • Anything that may be odd or unintuitive is provided with a GitHub comment explaining it (but consider if this should not be a code comment or in the documentation instead).
  • All CI checks pass before pinging a reviewer, or provide an explanation if they do not.

Related Issues

Closes #457

# We do not want the review to be deleted when the original requestee is deleted,
# there could be e.g., shared ownership in which case the review data should be preserved.
requestee_identifier: str | None = Field(
foreign_key="user.subject_identifier",
ondelete="SET NULL",
exclude=True,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the field is now only defined on the ORM class and not on the classes returned by FastAPI, we no longer need to protect it from being serialized.

Comment on lines +53 to +55
def get_session():
with DbSession() as session:
yield session
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful to allow a session to be alive also during the FastAPI layer, where the function's return object (e.g., Submission) is coerced into the model response (e.g., SubmissionWithReviews), which may require access to database data (e.g., submission.reviews). The alternative is always eagerly loading the reviews, but that is much worse performance-wise. We probably should rewrite some other endpoints to also use this pattern.

@PGijsbers PGijsbers requested a review from Taniya-Das February 26, 2025 13:09
@PGijsbers PGijsbers added the enhancement New feature or request label Feb 27, 2025
Copy link
Collaborator

@Taniya-Das Taniya-Das left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@PGijsbers PGijsbers merged commit 2cda7f5 into develop Feb 27, 2025
1 check passed
@PGijsbers PGijsbers deleted the feat/review-with-submission branch February 27, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] add the review decision and comment in the submission list
2 participants