Skip to content

Commit

Permalink
fix #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Benature committed Nov 28, 2023
1 parent cb83e96 commit 92559ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion WordReview/apps/review/templates/homepage.pug
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ div.container.flex-column
a(style="color:grey; font-size:14px;" href="https://gitter.im/WordReview/community") Gitter
a  / 
a(style="color:grey; font-size:14px;" href="https://discord.gg/6sE32Jh") Discord
a.text-center(style="color:grey; font-size:10px;" href="https://github.com/Benature/WordReview") 如果能帮到您 希望可以在 GitHub 点个 Star🌟 也是对我莫大的鼓励 不胜感激🙇‍♂️
a.text-center(style="color:grey; font-size:10px;" href="https://github.com/Benature/WordReview") 如果能帮到您希望可以在 GitHub 点个 Star🌟 也是对我莫大的鼓励不胜感激🙇‍♂️
{% endblock %}
14 changes: 8 additions & 6 deletions WordReview/apps/review/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ def review_lists(request):
status = 200
for LIST in LISTS:
try:
# list data: where flag < 1
ld = Review.objects.filter(BOOK=BOOK, LIST=LIST,
flag__lt=1) # list data
# list data passed: where flag > 0
ld_pass = Review.objects.filter(BOOK=BOOK, LIST=LIST,
flag__gt=0) # list data
L_db = BookList.objects.get(BOOK=BOOK, LIST=LIST)
Expand All @@ -118,20 +120,20 @@ def review_lists(request):
L_db.word_num = len(ld) + len(ld_pass)

# 背过的单词进度
rate = sum([r[0] if r[0] != -1 else 1
for r in ld.values_list('rate')]) / L_db.word_num
rate = 1 - rate if rate != 0.0 else 0
list_rate = len([r for r in ld.values_list('rate') if r[0] != -1
]) / L_db.word_num
list_rate = 1 - list_rate if list_rate != 0.0 else 0

if rate == 0:
if list_rate == 0 and len(ld) > 0:
status = 404
msg = '你怕是还没背过这个List'
msg = '你好像还没背过这个 List 诶 😳'
continue

L_db.unlearned_num = len(ld)
L_db.review_word_counts = ';'.join(
set([str(t[0]) for t in ld.values_list('total_num')]))

L_db.list_rate = rate
L_db.list_rate = list_rate
# 计算近期记忆率
recent_history = ''
for word in ld:
Expand Down

0 comments on commit 92559ff

Please sign in to comment.