Skip to content

Commit

Permalink
Fix some errors in handling table description knowls
Browse files Browse the repository at this point in the history
  • Loading branch information
roed314 committed May 7, 2024
1 parent 37c4422 commit 023a7e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions lmfdb/knowledge/knowl.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ def __init__(self, ID, template_kwargs=None, data=None, editing=False, showing=F
elif len(pieces) == 2:
# Table
self.title = f"Table {pieces[1]}"
self.coltype = None
if pieces[1] not in db.tablenames:
self.title += " (DEFUNCT)"
#self.reviewer = data.get('reviewer') # Not returned by get_knowl by default
Expand Down
9 changes: 3 additions & 6 deletions lmfdb/knowledge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,10 @@ def edit(ID):
title = "Edit Knowl '%s'" % ID
elif knowl.type == 2:
pieces = ID.split(".")
title = f"Edit column information for '{pieces[2]}' in '{pieces[1]}'"
knowl.title = f"Column {pieces[2]} of table {pieces[1]}"
from lmfdb import db
if pieces[1] in db.tablenames:
knowl.coltype = db[pieces[1]].col_type.get(pieces[2], "DEFUNCT")
if knowl.source:
title = f"Edit column information for '{knowl.source_name}' in '{knowl.source}'"
else:
knowl.coltype = "DEFUNCT"
title = f"Edit description for '{knowl.source_name}'"
else:
ann_type = 'Top' if knowl.type == 1 else 'Bottom'
title = 'Edit %s Knowl for <a href="/%s">%s</a>' % (ann_type, knowl.source, knowl.source_name)
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/knowledge/templates/knowl-show.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% from "knowl-defs.html" import knowlbar with context %}
{{ knowlbar(show_kid=True) }}

{% if k.type == 2 %}
{% if k.type == 2 and k.coltype %}
<p>
Postgres column type: {{ k.coltype }}
</p>
Expand Down

0 comments on commit 023a7e6

Please sign in to comment.