Browse Source

fix: choose next one

tree
欧醚 3 years ago
parent
commit
cfe1d60fab
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      app.py
  2. +1
    -1
      init_data.py

+ 1
- 1
app.py View File

@ -94,7 +94,7 @@ class Reaction(db.Model):
def choose_new_next(min_like_num=10):
for story in Story.query.filter_by(is_tree=False).all():
last_paragraph_id = Story.tail
last_paragraph_id = story.tail
next_one = Paragraph.query.filter_by(parent_id=last_paragraph_id, is_hidden=False)\
.order_by(Paragraph.like_num.desc()).first()
if next_one and next_one.like_num >= min_like_num:

+ 1
- 1
init_data.py View File

@ -57,7 +57,7 @@ BEGIN_WORDS = [
]
for idx, (title, text, avatar) in zip(range(1, 11), BEGIN_WORDS):
s = Story(id=idx, title=title, text=text, tail=idx,
s = Story(id=idx, title=title, text=text, tail=idx, is_tree=(idx == 10),
avatar="/ordinary/static/img/" + avatar)
p = Paragraph(id=idx, text=text, story_id=idx, is_chosen=True,
author="初始设定")

Loading…
Cancel
Save