diff options
author | Munyoki Kilyungi | 2024-09-02 09:41:12 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-05 16:39:14 +0300 |
commit | a22e0ea9553ea39e7b324306e0d9026311ba8125 (patch) | |
tree | 301cb142f2d1df9bfa3a727211bbb6f883fcf921 | |
parent | 3fe11df19d4f7c1a60a3180e06dd592fdc32f1f1 (diff) | |
download | genenetwork3-a22e0ea9553ea39e7b324306e0d9026311ba8125.tar.gz |
Fix type error.
* gn3/api/metadata_api/wiki.py: Remove FIXME comment.
* gn3/db/wiki.py: Fix type error.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r-- | gn3/api/metadata_api/wiki.py | 3 | ||||
-rw-r--r-- | gn3/db/wiki.py | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/gn3/api/metadata_api/wiki.py b/gn3/api/metadata_api/wiki.py index 0b71c04..9ea0d53 100644 --- a/gn3/api/metadata_api/wiki.py +++ b/gn3/api/metadata_api/wiki.py @@ -95,9 +95,6 @@ def get_wiki(comment_id: int): TODO: fetch this from RIF """ with db_utils.database_connection(current_app.config["SQL_URI"]) as conn: - # FIXME: error: Argument 2 to "get_latest_comment" has - # incompatible type "int"; expected "str" [arg-type] - # type: ignore return jsonify(wiki.get_latest_comment(conn, comment_id)) return jsonify(error="Error fetching wiki entry, most likely due to DB error!"), 500 diff --git a/gn3/db/wiki.py b/gn3/db/wiki.py index 7c58459..7ef5e68 100644 --- a/gn3/db/wiki.py +++ b/gn3/db/wiki.py @@ -9,7 +9,7 @@ class MissingDBDataException(Exception): """Error due to DB missing some data""" -def get_latest_comment(connection, comment_id: str) -> int: +def get_latest_comment(connection, comment_id: int) -> int: """ Latest comment is one with the highest versionId """ cursor = connection.cursor(DictCursor) query = """ SELECT versionId AS version, symbol, PubMed_ID AS pubmed_ids, sp.Name AS species, @@ -19,7 +19,7 @@ def get_latest_comment(connection, comment_id: str) -> int: WHERE gr.Id = %s ORDER BY versionId DESC LIMIT 1; """ - cursor.execute(query, (comment_id,)) + cursor.execute(query, (str(comment_id),)) result = cursor.fetchone() result["pubmed_ids"] = [x.strip() for x in result["pubmed_ids"].split()] categories_query = """ |