Skip to content

Commit

Permalink
Update sequencing group 'project:' filter to parse names, not ids (#585)
Browse files Browse the repository at this point in the history
* Update sequencing group 'project:' filter to parse project names, not ids

* Update sequencing group 'project:' filter to parse names, not ids

* Add project filter into test_sg_analyses_query

* Update gql schema sample project filter
  • Loading branch information
EddieLF authored Oct 25, 2023
1 parent dd1ba37 commit f109327
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions api/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ async def sample(

project_name_map: dict[str, int] = {}
if project:
project_ids = project.all_values()
projects = await ptable.get_and_check_access_to_projects_for_ids(
user=connection.author, project_ids=project_ids, readonly=True
project_names = project.all_values()
projects = await ptable.get_and_check_access_to_projects_for_names(
user=connection.author, project_names=project_names, readonly=True
)
project_name_map = {p.name: p.id for p in projects}

Expand Down Expand Up @@ -633,9 +633,9 @@ async def sequencing_groups(
# we list project names, but internally we want project ids
project_id_map = {}
if project:
project_ids = project.all_values()
projects = await ptable.get_and_check_access_to_projects_for_ids(
user=connection.author, project_ids=project_ids, readonly=True
project_names = project.all_values()
projects = await ptable.get_and_check_access_to_projects_for_names(
user=connection.author, project_names=project_names, readonly=True
)
project_id_map = {p.name: p.id for p in projects}

Expand Down
2 changes: 1 addition & 1 deletion test/test_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ async def test_sg_analyses_query(self):

q = """
query MyQuery($sg_id: String!, $project: String!) {
sequencingGroups(id: {in_: [$sg_id]}) {
sequencingGroups(id: {in_: [$sg_id]}, project: {eq: $project}) {
analyses(project: {eq: $project}) {
id
meta
Expand Down

0 comments on commit f109327

Please sign in to comment.