Skip to content
Snippets Groups Projects
Commit d0922176 authored by Martin Mareš's avatar Martin Mareš
Browse files

Fixed bug in creation of topics

parent d4c6536a
Branches
No related tags found
No related merge requests found
...@@ -1175,11 +1175,14 @@ def admin_edit_topic(sident, cident, tid=None, copy_tid=None): ...@@ -1175,11 +1175,14 @@ def admin_edit_topic(sident, cident, tid=None, copy_tid=None):
return render_template('admin-edit-topic.html', form=form, tid=None, copy_tid=None, post_count=None) return render_template('admin-edit-topic.html', form=form, tid=None, copy_tid=None, post_count=None)
if tid is None: if tid is None:
assert form.copy_to.data is not None if copy_tid is None:
db_query("INSERT INTO owl_topics(cid, type) VALUES(%s, 'H') RETURNING *", (form.copy_to.data,)) cid = g.course.cid
else:
cid = form.copy_to.data
assert cid is not None
db_query("INSERT INTO owl_topics(cid, type) VALUES(%s, 'H') RETURNING *", (cid,))
row = db.fetchone() row = db.fetchone()
assert row assert row
cid = row.cid
tid = row.tid tid = row.tid
app.logger.info(f"Created topic: cid={cid} tid={tid} by_uid={g.uid}") app.logger.info(f"Created topic: cid={cid} tid={tid} by_uid={g.uid}")
else: else:
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment