From 1fe3481e4aa13e0e3ddef5b03978c6d44c6dc5d7 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Tue, 13 Jul 2021 11:52:31 +0800 Subject: =?UTF-8?q?Incorporate=20the=20branch=20SPM-Spring2021-2597-?= =?UTF-8?q?=E5=8D=A0=E5=81=A5=E8=B1=AA201831990539?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/main.py') diff --git a/app/main.py b/app/main.py index f35b65c..6053266 100644 --- a/app/main.py +++ b/app/main.py @@ -274,12 +274,14 @@ def user_mark_word(username): def unfamiliar(username,word): user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) pickle_idea.unfamiliar(user_freq_record,word) + session['thisWord'] = word # 1. put a word into session return redirect(url_for('userpage', username=username)) @app.route("///familiar", methods=['GET', 'POST']) def familiar(username,word): user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) pickle_idea.familiar(user_freq_record,word) + session['thisWord'] = word # 1. put a word into session return redirect(url_for('userpage', username=username)) @app.route("///del", methods=['GET', 'POST']) @@ -349,7 +351,13 @@ def userpage(username): document.getElementById("text-content").addEventListener("touchstart", fillinWord, false); ''' - + if session.get('thisWord'): + page += ''' + + ''' + d = load_freq_history(user_freq_record) if len(d) > 0: page += '

我的生词簿

' @@ -360,6 +368,8 @@ def userpage(username): for x in sort_in_descending_order(lst2): word = x[0] freq = x[1] + if session.get('thisWord') == x[0]: + page += '' # 3. anchor if isinstance(d[word], list): # d[word] is a list of dates if freq > 1: page += '

%s(%d) 熟悉 不熟悉 删除

\n' % (youdao_link(word), word, '; '.join(d[word]), freq,username, word,username,word, username,word) -- cgit v1.2.1