diff --git a/app/main.py b/app/main.py index 1356f12..6d743bb 100644 --- a/app/main.py +++ b/app/main.py @@ -270,6 +270,17 @@ def user_mark_word(username): return 'Under construction' +@app.route("///unfamiliar", methods=['GET', 'POST']) +def unfamiliar(username,word): + user_freq_record = path_prefix + 'static/frequency/' + 'frequency_%s.pickle' % (username) + pickle_idea.unfamiliar(user_freq_record,word) + 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) + return redirect(url_for('userpage', username=username)) @app.route("/", methods=['GET', 'POST']) def userpage(username): @@ -345,13 +356,11 @@ def userpage(username): freq = x[1] 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) + page += '

%s(%d) 熟悉 不熟悉

\n' % (youdao_link(word), word, '; '.join(d[word]), freq,username, word,username,word) else: - page += '

%s (%d)

\n' % (youdao_link(word), word, '; '.join(d[word]), freq) + page += '

%s(%d) 熟悉 不熟悉

\n' % (youdao_link(word), word, '; '.join(d[word]), freq,username, word,username,word) elif isinstance(d[word], int): # d[word] is a frequency. to migrate from old format. - page += '%s%d\n' % (youdao_link(word), word, freq) - - + page += '%s%d\n' % (youdao_link(word), word, freq) return page ### Sign-up, login, logout ###