diff --git a/app/main.py b/app/main.py index 043e668..e2ad1f7 100644 --- a/app/main.py +++ b/app/main.py @@ -275,6 +275,7 @@ 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 + session['time'] = 1 return redirect(url_for('userpage', username=username)) @app.route("///familiar", methods=['GET', 'POST']) @@ -282,6 +283,7 @@ 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 + session['time'] = 1 return redirect(url_for('userpage', username=username)) @app.route("/", methods=['GET', 'POST']) @@ -348,7 +350,12 @@ def userpage(username): if session.get('thisWord'): page += ''' ''' @@ -362,8 +369,9 @@ def userpage(username): for x in sort_in_descending_order(lst2): word = x[0] freq = x[1] - if session.get('thisWord') == x[0]: + if session.get('thisWord') == x[0] and session.get('time') == 1: page += '' # 3. anchor + session['time'] = 0 # discard 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)