diff options
Diffstat (limited to 'uploader')
-rw-r--r-- | uploader/phenotypes/views.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 97bcafe..8e47242 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -374,10 +374,15 @@ def process_phenotypes_individual_files(error_uri): bundlepath = Path(app.config["UPLOAD_FOLDER"], f"{str(uuid.uuid4()).replace('-', '')}.zip") with ZipFile(bundlepath,mode="w") as zfile: - for rqtlkey, formkey in (("phenocovar", "phenotype-descriptions"), - ("pheno", "phenotype-data"), - ("phenose", "phenotype-se"), - ("phenonum", "phenotype-n")): + for rqtlkey, formkey, _type in ( + ("phenocovar", "phenotype-descriptions", "mandatory"), + ("pheno", "phenotype-data", "mandatory"), + ("phenose", "phenotype-se", "optional"), + ("phenonum", "phenotype-n", "optional")): + if _type == "optional" and not bool(form.get(formkey)): + # skip if an optional key does not exist. + continue + cdata[f"{rqtlkey}_transposed"] = ( (form.get(f"{formkey}-transposed") or "off") == "on") |