diff --git a/app/main.py b/app/main.py index 6d743bb..043e668 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("/", methods=['GET', 'POST']) @@ -343,7 +345,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 += '

我的生词簿

' @@ -354,6 +362,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)