From f4c458f71e94254b05c42c1f1c5caaac2e687e72 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 3 May 2022 18:04:09 +0300 Subject: Replace references of "publish_xref.pubmed_id" with "publication.id" See: https://issues.genenetwork.org/issues/edit-metadata-bugs.html * wqflask/wqflask/metadata_edits (edit_phenotype): When diffing, should there be a null, use a "" during page display. Also, use the "publication.id_" instead of "publication.pubmed_id" when updating a publication. * wqflask/wqflask/templates/edit_phenotype.html: In the HTML form, use values of "publication" instead of "publish_xref" when referring to a publication. --- wqflask/wqflask/metadata_edits.py | 5 +++-- wqflask/wqflask/templates/edit_phenotype.html | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 49b03943..10022ae1 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -130,7 +130,7 @@ def edit_phenotype(conn, name, dataset_id): data_.get("new"), "\n".join( difflib.ndiff( - [data_.get("old")], [data_.get("new")] + [data_.get("old") or ""], [data_.get("new")] ) ), ), @@ -357,6 +357,7 @@ def update_phenotype(dataset_id: str, name: str): } ) publication_ = { + "pubmed_id": data_.get("pubmed-id"), "abstract": data_.get("abstract"), "authors": data_.get("authors"), "title": data_.get("title"), @@ -373,7 +374,7 @@ def update_phenotype(dataset_id: str, name: str): "Publication", data=Publication(**publication_), where=Publication( - id_=data_.get("pubmed-id", data_.get("old_id_")) + id_=data_.get("old_id_") ), ) if updated_publications: diff --git a/wqflask/wqflask/templates/edit_phenotype.html b/wqflask/wqflask/templates/edit_phenotype.html index b90c7daf..617848ad 100644 --- a/wqflask/wqflask/templates/edit_phenotype.html +++ b/wqflask/wqflask/templates/edit_phenotype.html @@ -81,8 +81,8 @@ Description will be ignored. Do not enter any non-digit character in this field. -->
- - + +
-- cgit v1.2.3