From df5860f127131a4601b54805f90b22a55479ba56 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 13 Dec 2022 00:34:11 +0300 Subject: add check for file in web/ProbeSetFreeze_DataMatrix folder (#758) --- wqflask/wqflask/correlation/pre_computes.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/wqflask/wqflask/correlation/pre_computes.py b/wqflask/wqflask/correlation/pre_computes.py index 37f037a7..9ffbebf6 100644 --- a/wqflask/wqflask/correlation/pre_computes.py +++ b/wqflask/wqflask/correlation/pre_computes.py @@ -174,16 +174,23 @@ def get_datasets_data(base_dataset, target_dataset_data): def fetch_text_file(dataset_name, conn, text_dir=TMPDIR): """fetch textfiles with strain vals if exists""" + + def __file_scanner__(text_dir,target_file): + for file in os.listdir(text_dir): + if file.startswith(f"ProbeSetFreezeId_{results[0]}_"): + return os.path.join(text_dir,file) + with conn.cursor() as cursor: cursor.execute( 'SELECT Id, FullName FROM ProbeSetFreeze WHERE Name = %s', (dataset_name,)) results = cursor.fetchone() if results: try: - for file in os.listdir(text_dir): - if file.startswith(f"ProbeSetFreezeId_{results[0]}_"): - return os.path.join(text_dir, file) - except FileNotFoundError: + # addition check for matrix file in gn_matrix folder + + return __file_scanner__(text_dir,results) or __file_scanner__(TEXTDIR,results) + + except Exception: pass -- cgit v1.2.3