Skip to content

Commit

Permalink
Change get_unique_applications to get_unique_application_tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizsavinhas committed Jan 13, 2025
1 parent 295e714 commit e8089af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cg/meta/delivery_report/delivery_report_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ def get_case_data(
samples: list[SampleModel] = self.get_samples_data(
case=case, analysis_metadata=analysis_metadata
)
unique_applications: list[ApplicationModel] = self.get_unique_applications(samples=samples)
unique_application_tags: list[str] = self.get_unique_application_tags(samples=samples)
return CaseModel(
name=case.name,
id=case.internal_id,
data_analysis=self.get_case_analysis_data(case=case, analysis=analysis),
samples=samples,
applications=unique_applications,
applications=unique_application_tags,
)

def get_samples_data(self, case: Case, analysis_metadata: AnalysisModel) -> list[SampleModel]:
Expand Down Expand Up @@ -324,12 +324,12 @@ def get_sample_application(
)

@staticmethod
def get_unique_applications(samples: list[SampleModel]) -> list[ApplicationModel]:
def get_unique_application_tags(samples: list[SampleModel]) -> list[ApplicationModel]:
"""Returns the unique case associated applications."""
applications = list()
for sample in samples:
if sample.application not in applications:
applications.append(sample.application)
applications.append(sample.application.tag)
return applications

def get_sample_methods_data(self, sample_id: str) -> MethodsModel:
Expand Down
2 changes: 1 addition & 1 deletion cg/models/delivery_report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class CaseModel(BaseModel):
id: case ID; source: StatusDB/family/internal_id
samples: list of samples associated to a case/family
data_analysis: workflow attributes
applications: case associated unique applications
applications: case associated unique application tags
"""

name: Annotated[str, BeforeValidator(get_report_string)] = NA_FIELD
Expand Down
2 changes: 1 addition & 1 deletion tests/meta/delivery_report/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_get_unique_applications(request: FixtureRequest, workflow: Workflow):
)

# WHEN filtering unique applications
unique_applications: list[ApplicationModel] = delivery_report_api.get_unique_applications(
unique_applications: list[ApplicationModel] = delivery_report_api.get_unique_application_tags(
samples
)

Expand Down

0 comments on commit e8089af

Please sign in to comment.