Skip to content

Commit

Permalink
Add analyses loading to query
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdamin committed Dec 13, 2024
1 parent 8f4d056 commit aa566bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion genotype_api/database/crud/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ async def refresh_sample_status(
return sample

async def update_sample_comment(self, sample_id: str, comment: str) -> Sample:
query: Query = select(Sample).distinct().filter(Sample.id == sample_id)
query: Query = (
select(Sample).options(selectinload(Sample.analyses)).filter(Sample.id == sample_id)
)
sample: Sample = await self.fetch_one_or_none(query)

if not sample:
raise SampleNotFoundError

sample.comment = comment
self.session.add(sample)
await self.session.commit()
Expand Down

0 comments on commit aa566bf

Please sign in to comment.