Skip to content

Commit

Permalink
add func
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrOertlin committed Mar 20, 2024
1 parent 2aff759 commit 3ae762c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions genotype_api/services/analysis_service/analysis_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from genotype_api.database.crud.read import (
get_analysis_by_id,
get_analyses_with_skip_and_limit,
get_analyses,
check_analyses_objects,
)
from genotype_api.database.crud.update import refresh_sample_status
Expand Down Expand Up @@ -43,18 +42,7 @@ def get_analyses_to_display(self, skip: int, limit: int) -> list[AnalysisRespons
analyses: list[Analysis] = get_analyses_with_skip_and_limit(
session=self.session, skip=skip, limit=limit
)
return [
AnalysisResponse(
type=analysis.type,
source=analysis.source,
sex=analysis.sex,
created_at=analysis.created_at,
sample_id=analysis.sample_id,
plate_id=analysis.plate_id,
id=analysis.id,
)
for analysis in analyses
]
return self.create_analyses_response(analyses)

def get_upload_sequence_analyses(self, file: UploadFile) -> list[AnalysisResponse]:
"""
Expand All @@ -73,6 +61,10 @@ def get_upload_sequence_analyses(self, file: UploadFile) -> list[AnalysisRespons
analysis: Analysis = create_analysis(session=self.session, analysis=analysis)
refresh_sample_status(session=self.session, sample=analysis.sample)

return self.create_analyses_response(analyses)

@staticmethod
def create_analyses_response(analyses: list[Analysis]) -> list[AnalysisResponse]:
return [
AnalysisResponse(
type=analysis.type,
Expand Down

0 comments on commit 3ae762c

Please sign in to comment.