diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2020-08-13 09:55:23 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2020-08-13 09:55:23 +0800 |
commit | 21ce86d2052f461ae4548c6894ff8eaa3a5ca915 (patch) | |
tree | 3c8e335c87c30b6cce383f58761dd17b3b6added /app/wordfreqWEB.py | |
parent | a13cf9f58aa30400770dd141f1ecbbe9cafadfcc (diff) |
main.py and wordfreqWEB.py: do not show word frequency if it is 1.
Diffstat (limited to 'app/wordfreqWEB.py')
-rw-r--r-- | app/wordfreqWEB.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/wordfreqWEB.py b/app/wordfreqWEB.py index 7107791..2c0e4be 100644 --- a/app/wordfreqWEB.py +++ b/app/wordfreqWEB.py @@ -269,7 +269,10 @@ def userpage(username): word = x[0]
freq = x[1]
if isinstance(d[word], list): # d[word] is a list of dates
- page += '<a href="%s">%s</a> (<a title="%s">%d</a>)\n' % (youdao_link(word), word, '; '.join(d[word]), freq)
+ if freq > 1:
+ page += '<a href="%s">%s</a> (<a title="%s">%d</a>)\n' % (youdao_link(word), word, '; '.join(d[word]), freq)
+ else:
+ page += '<a href="%s">%s</a>\n' % (youdao_link(word), word)
elif isinstance(d[word], int): # d[word] is a frequency. to migrate from old format.
page += '<a href="%s">%s</a>%d\n' % (youdao_link(word), word, freq)
|