From 3d0ab4daff49a5193ceb97b4d764a4e7e6efd15a Mon Sep 17 00:00:00 2001 From: EddieLF Date: Wed, 13 Sep 2023 17:32:18 +1000 Subject: [PATCH] Use project.id in queries --- db/python/layers/web.py | 19 +++++++++++-------- test/test_web.py | 6 +++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/db/python/layers/web.py b/db/python/layers/web.py index 0293aabe5..cd58fd65d 100644 --- a/db/python/layers/web.py +++ b/db/python/layers/web.py @@ -318,28 +318,31 @@ def get_val_for_project_and_sequencing_type( ) response = [] - for project_id in projects: - project = await ptable.get_project_by_id(project_id) + for pid in projects: + project = await ptable.get_project_by_id(pid) for sequencing_type in sequencing_types: response.append( ProjectsSummaryInternal( - project=project_id, + project=project.id, dataset=project.name, sequencing_type=sequencing_type, total_families=get_val_for_project_and_sequencing_type( - project, sequencing_type, 'num_families', families + project.id, sequencing_type, 'num_families', families ), total_participants=get_val_for_project_and_sequencing_type( - project, sequencing_type, 'num_participants', participants + project.id, + sequencing_type, + 'num_participants', + participants, ), total_samples=get_val_for_project_and_sequencing_type( - project, sequencing_type, 'num_samples', samples + project.id, sequencing_type, 'num_samples', samples ), total_sequencing_groups=get_val_for_project_and_sequencing_type( - project, sequencing_type, 'num_sgs', sequencing_groups + project.id, sequencing_type, 'num_sgs', sequencing_groups ), total_crams=get_val_for_project_and_sequencing_type( - project, sequencing_type, 'num_crams', crams + project.id, sequencing_type, 'num_crams', crams ), # latest_es_index_output=self._projects_summary_es_indices_query( # [project], sequencing_types diff --git a/test/test_web.py b/test/test_web.py index 140e670b0..b9336c363 100644 --- a/test/test_web.py +++ b/test/test_web.py @@ -216,9 +216,9 @@ async def test_projects_summary(self): dataset='test', sequencing_type='genome', total_families=0, - total_participants=0, - total_samples=0, - total_sequencing_groups=0, + total_participants=1, + total_samples=1, + total_sequencing_groups=1, total_crams=0, ), ProjectsSummaryInternal(