Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrOertlin committed Apr 3, 2024
1 parent 27977b4 commit e4044a1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions genotype_api/services/sample_service/sample_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, session: Session):
self.session = session

@staticmethod
def _get_analyses_on_sample(sample: Sample) -> list[AnalysisOnSample] | None:
def _get_analyses_on_sample(sample: Sample, plate_id=None) -> list[AnalysisOnSample] | None:
analyses: list[AnalysisOnSample] = []
if not sample.analyses:
return None
Expand All @@ -43,14 +43,16 @@ def _get_analyses_on_sample(sample: Sample) -> list[AnalysisOnSample] | None:
type=analysis.type,
sex=analysis.sex,
sample_id=analysis.sample_id,
plate_id=analysis.plate_id,
plate_id=plate_id,
id=analysis.id,
)
analyses.append(analysis_on_sample)
return analyses

def _get_sample_response(self, sample: Sample) -> SampleResponse:
analyses: list[AnalysisOnSample] = self._get_analyses_on_sample(sample)
def _get_sample_response(self, sample: Sample, plate_id=None) -> SampleResponse:
analyses: list[AnalysisOnSample] = self._get_analyses_on_sample(
sample=sample, plate_id=plate_id
)
return SampleResponse(
id=sample.id,
status=sample.status,
Expand All @@ -72,7 +74,9 @@ def get_samples(self, filter_params: SampleFilterParams) -> list[SampleResponse]
samples: list[Sample] = get_filtered_samples(
session=self.session, filter_params=filter_params
)
return [self._get_sample_response(sample) for sample in samples]
return [
self._get_sample_response(sample, plate_id=filter_params.plate_id) for sample in samples
]

def create_sample(self, sample: Sample):
create_sample(session=self.session, sample=sample)
Expand Down

0 comments on commit e4044a1

Please sign in to comment.