aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/auth/authorisation/groups/views.py13
-rw-r--r--gn3/auth/authorisation/resources/models.py1
2 files changed, 8 insertions, 6 deletions
diff --git a/gn3/auth/authorisation/groups/views.py b/gn3/auth/authorisation/groups/views.py
index d21466c..0e779eb 100644
--- a/gn3/auth/authorisation/groups/views.py
+++ b/gn3/auth/authorisation/groups/views.py
@@ -163,19 +163,22 @@ def unlinked_data(resource_type: str) -> Response:
"SELECT group_id, dataset_type, "
"trait_id AS dataset_or_trait_id FROM phenotype_resources")
- ids_query = ("SELECT group_id, dataset_type, dataset_or_trait_id "
- "FROM linked_group_data "
- f"{type_filter} "
- f"EXCEPT {except_filter} ")
+ ids_query = (
+ "SELECT * FROM ("
+ "SELECT group_id, dataset_type, dataset_or_trait_id "
+ "FROM linked_group_data "
+ f"EXCEPT SELECT * FROM ({except_filter})"
+ f") {type_filter}")
cursor.execute(ids_query)
ids = cursor.fetchall()
+ print(f"THE IDS: {ids} ==> {type_filter}")
if ids:
clause = ", ".join(["(?, ?, ?)"] * len(ids))
data_query = (
"SELECT * FROM linked_group_data "
"WHERE (group_id, dataset_type, dataset_or_trait_id) "
- f"IN (VALUES {clause})")
+ f"IN (VALUES {clause}) ")
params = tuple(item for sublist in
((row[0], row[1], row[2]) for row in ids)
for item in sublist)
diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py
index d3023ac..3547bc6 100644
--- a/gn3/auth/authorisation/resources/models.py
+++ b/gn3/auth/authorisation/resources/models.py
@@ -207,7 +207,6 @@ def attach_resource_data(cursor: db.DbCursor, resource: Resource) -> Resource:
dict(data_row) for data_row in
resource_data_function[category.resource_category_key](
cursor, resource.resource_id))
- print(f"DATA ROWS: {data_rows}")
return Resource(
resource.group, resource.resource_id, resource.resource_name,
resource.resource_category, resource.public, data_rows)