From d1adfc7f679c0ab09b41d6de67918aba82035253 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 2 Mar 2022 15:54:19 +0300 Subject: Use updated `insert_sample_data` from gn3 --- wqflask/wqflask/metadata_edits.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index d6ba2fff..24cbd3d1 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -558,19 +558,14 @@ def approve_data(resource_id:str, file_name: str): sample_data.get("Deletions").remove(deletion) n_insertions = 0 - for insertion in ( - insertions := [d for d in sample_data.get("Additions")]): - (strain_name, - value, se, count) = insertion.split(",") - __insertions, _, _ = insert_sample_data( - conn=conn, - trait_name=sample_data.get("trait_name"), - strain_name=strain_name, - phenotype_id=int(sample_data.get("phenotype_id")), - value=value, - error=se, - count=count) - if __insertions: + for data in [d for d in sample_data.get("Additions")]: + if insert_sample_data( + conn=conn, + trait_name=sample_data.get("trait_name"), + data=data, + csv_header=sample_data.get("Columns", + "Strain Name,Value,SE,Count"), + phenotype_id=int(sample_data.get("phenotype_id"))): n_insertions += 1 # Remove any data that already exists from sample_data inserts else: -- cgit v1.2.3