diff --git a/fishbook/backend/database.py b/fishbook/backend/database.py index ce847bf..592caca 100644 --- a/fishbook/backend/database.py +++ b/fishbook/backend/database.py @@ -457,14 +457,7 @@ def scan_folder_for_repros(dataset): cell_id = (Cells * CellDatasetMap * (Datasets & "dataset_id = '%s'" % dataset["dataset_id"])).fetch("cell_id", limit=1)[0] for rs, si in zip(repro_settings, stim_indices): rp = Repros.get_template_tuple() - path = [] - if not find_key_recursive(rs, "run", path): - find_key_recursive(rs, "Run", path) - if len(path) > 0: - rp["run"] = deep_get(rs, path, 0) - else: - rp["run"] = -1 - + path = [] if not find_key_recursive(rs, "repro", path): find_key_recursive(rs, "RePro", path) @@ -474,7 +467,16 @@ def scan_folder_for_repros(dataset): if rp["repro_name"] in repro_counts.keys(): repro_counts[rp["repro_name"]] += 1 else: - repro_counts[rp["repro_name"]] = 1 + repro_counts[rp["repro_name"]] = 0 + + path = [] + if not find_key_recursive(rs, "run", path): + find_key_recursive(rs, "Run", path) + if len(path) > 0: + rp["run"] = deep_get(rs, path, 0) + else: # the run information is not there and needs to be fixed! + rp["run"] = repro_counts[rp["repro_name"]] + rp["cell_id"] = cell_id rp["repro_id"] = rp["repro_name"] + str(repro_counts[rp["repro_name"]]) rp["start"] = 0.