mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-20 13:53:42 -05:00
add unread question count
This commit is contained in:
parent
bcf7972f77
commit
f316d89e9d
1 changed files with 4 additions and 2 deletions
6
app.py
6
app.py
|
@ -105,8 +105,8 @@ def inject_stuff():
|
||||||
app.logger.debug("[CatAsk] app.context_processor inject_stuff() triggered")
|
app.logger.debug("[CatAsk] app.context_processor inject_stuff() triggered")
|
||||||
cfg = func.loadJSON(const.configFile)
|
cfg = func.loadJSON(const.configFile)
|
||||||
# for 1.6.0 or later
|
# for 1.6.0 or later
|
||||||
# questionCount = getQuestionCount()
|
questionCount = int(getQuestionCount())
|
||||||
return dict(metadata=func.generateMetadata(), len=len, str=str, const=const, cfg=cfg, logged_in=logged_in, version_id=const.version_id, version=const.version, appName=const.appName)
|
return dict(metadata=func.generateMetadata(), len=len, str=str, const=const, cfg=cfg, logged_in=logged_in, version_id=const.version_id, version=const.version, appName=const.appName, questionCount=questionCount)
|
||||||
|
|
||||||
# -- template filters --
|
# -- template filters --
|
||||||
@app.template_filter('render_markdown')
|
@app.template_filter('render_markdown')
|
||||||
|
@ -163,6 +163,8 @@ def inbox():
|
||||||
|
|
||||||
cursor.execute("SELECT * FROM questions WHERE answered=%s ORDER BY creation_date DESC", (False,))
|
cursor.execute("SELECT * FROM questions WHERE answered=%s ORDER BY creation_date DESC", (False,))
|
||||||
questions = cursor.fetchall()
|
questions = cursor.fetchall()
|
||||||
|
for question in questions:
|
||||||
|
cursor.execute("UPDATE questions SET unread=%s WHERE id=%s", (False, question['id']))
|
||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue