From 9a0c6fd1759e13fa7a934852f87e9aa4c62d7dfd Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 19 Apr 2023 14:42:31 +0300 Subject: auth: Setup selected traits correctly Fix bugs with setting up of the selected traits for use while filtering the search results. --- gn3/auth/authorisation/data/phenotypes.py | 2 ++ gn3/auth/authorisation/data/views.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'gn3/auth') diff --git a/gn3/auth/authorisation/data/phenotypes.py b/gn3/auth/authorisation/data/phenotypes.py index 3ba478a..db16699 100644 --- a/gn3/auth/authorisation/data/phenotypes.py +++ b/gn3/auth/authorisation/data/phenotypes.py @@ -17,6 +17,8 @@ def linked_phenotype_data( authcursor.execute("SELECT * FROM linked_phenotype_data") linked = tuple(tuple(row[key] for key in authkeys) for row in authcursor.fetchall()) + if len(linked) <= 0: + return (item for item in tuple()) paramstr = "".join(["(%s, %s, %s, %s)"] * len(linked)) query = ( "SELECT spc.SpeciesId, spc.SpeciesName, iset.InbredSetId, " diff --git a/gn3/auth/authorisation/data/views.py b/gn3/auth/authorisation/data/views.py index a14e78b..a9861d2 100644 --- a/gn3/auth/authorisation/data/views.py +++ b/gn3/auth/authorisation/data/views.py @@ -163,7 +163,7 @@ def __search_phenotypes__(): f"--gn3-db-uri={app.config['SQL_URI']}", f"--redis-uri={redisuri}", f"--per-page={__request_key__('per_page')}"] +( - [f"--selected='{json.dumps(selected)}"] + [f"--selected={json.dumps(selected)}"] if len(selected) > 0 else []) jobs.create_job(redisconn, { "job_id": job_id, "command": command, "status": "queued", -- cgit v1.2.3