Skip to content

Commit

Permalink
Add genotype analysis loading (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdamin authored Jan 15, 2025
1 parent a45c267 commit d16115e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion genotype_api/database/crud/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ 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).selectinload(Analysis.genotypes))
.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 d16115e

Please sign in to comment.