diff --git a/src/dao.py b/src/dao.py index 4f51364..1129b3e 100644 --- a/src/dao.py +++ b/src/dao.py @@ -21,11 +21,13 @@ def get_user_menu() -> tuple[str, str]: row = cursor.fetchone() if row: return row[0], row[1] - # else: - # cursor.execute("select menu from user_menu where user = ? order by datestr desc limit 1", (user,)) - # row = cursor.fetchone() - # if row: - # return row[0] + else: + cursor.execute( + "select menu, nickname from user_menu where user = ? and nickname is not null order by datestr desc limit 1", + (user,)) + row = cursor.fetchone() + if row: + return '{}', row[1] return '', '' finally: cursor.close() diff --git a/src/dinner.py b/src/dinner.py index 990675a..5358367 100644 --- a/src/dinner.py +++ b/src/dinner.py @@ -166,6 +166,7 @@ def dinner(): predict_result = roll_logic(check=True) else: predict_result = None + recent_results = list(fetch_roll_result_list(-1, 7)) return render_template('dinner.html', all_choice=all_choice, menu=menu, @@ -177,4 +178,5 @@ def dinner(): result=result, predict_result=predict_result, can_roll=can_roll, - last_results=last_results) + last_results=last_results, + recent_results=recent_results) diff --git a/templates/dinner.html b/templates/dinner.html index d8c413d..23d340d 100644 --- a/templates/dinner.html +++ b/templates/dinner.html @@ -12,7 +12,7 @@ {% for last_result in last_results %}

今日{{ last_result }}最终得票数降低{{ 2 + loop.index0 }}0%

{% endfor %} -
+
@@ -58,7 +58,7 @@
{% if (users|length) > 3 %}
- +
    {% for user in users %}
  • {{ user }}
  • @@ -66,6 +66,14 @@
{% endif %} +
+ +
    + {% for recent_result in recent_results %} +
  • {{ recent_result }}
  • + {% endfor %} +
+