From 84a184bdcda6e7a87f284bbfb2c001e703036a81 Mon Sep 17 00:00:00 2001
From: Hui Lan
Date: Wed, 10 Feb 2021 17:38:52 +0800
Subject: main.py: get the next article only when it is explicitly clicked.
Contributed by Mao Dun <794811132@qq.com>.
---
app/main.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/app/main.py b/app/main.py
index a02d043..eadf828 100644
--- a/app/main.py
+++ b/app/main.py
@@ -166,6 +166,18 @@ def get_answer_part(s):
return html_code
+
+@app.route("//reset", methods=['GET', 'POST'])
+def user_reset(username):
+ username = session[username]
+ user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username)
+ if request.method == 'POST':
+ session['article'] = get_today_article(user_freq_record)
+ return redirect(url_for('userpage', username=username))
+ else:
+ return 'Under construction'
+
+
@app.route("/mark", methods=['GET', 'POST'])
def mark_word():
if request.method == 'POST':
@@ -293,9 +305,9 @@ def userpage(username):
page += '\n' # forbid treating numbers as cell numbers in smart phones
page += 'EnglishPal Study Room for %s' % (username)
page += 'English Pal for %s 登出
' % (username)
- page += '下一篇
' % (username)
+ page += '
' % (username)
page += '阅读文章并回答问题
\n'
- page += '%s
' % (get_today_article(user_freq_record))
+ page += '%s
' % (session['article'])
page += '收集生词吧 (可以在正文中划词,也可以复制黏贴)
'
page += '