diff --git a/app/main.py b/app/main.py index 9008101..b13df3e 100644 --- a/app/main.py +++ b/app/main.py @@ -283,6 +283,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']) @@ -290,6 +291,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("///del", methods=['GET', 'POST']) @@ -362,7 +364,12 @@ def userpage(username): if session.get('thisWord'): page += ''' ''' @@ -376,8 +383,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, username,word)