Skip to content

Commit

Permalink
Use project.id in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
EddieLF committed Sep 13, 2023
1 parent 7240560 commit 3d0ab4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 11 additions & 8 deletions db/python/layers/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3d0ab4d

Please sign in to comment.