From ba84084f8ca3a0c0561bd89b6b28a6237c43c1bb Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Fri, 5 Nov 2021 14:24:30 +0800 Subject: [PATCH] update description --- app.py | 12 +++++++++--- templates/story.html | 7 ++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index edc1a35..ac97528 100644 --- a/app.py +++ b/app.py @@ -22,6 +22,9 @@ WRONG_ANS_HTML = ''' ''' +MIN_LIKE_NUM = 10 + + app = Flask(__name__) app.config.from_object('config.C') app.secret_key = C.session_key @@ -92,7 +95,7 @@ class Reaction(db.Model): user = db.Column(db.String(30)) # username of user -def choose_new_next(min_like_num=10): +def choose_new_next(min_like_num=MIN_LIKE_NUM): for story in Story.query.filter_by(is_tree=False).all(): last_paragraph_id = story.tail next_one = Paragraph.query.filter_by(parent_id=last_paragraph_id, is_hidden=False)\ @@ -199,6 +202,9 @@ def story(story_id): guest_login_url = url_for('main_bp.guest_login') verify_questions = sample_question(C.verify_questions) + min_like_num = MIN_LIKE_NUM + email = C.email + return render_template('story.html', **locals()) @@ -260,8 +266,8 @@ def react(): @bp.route('/choose') def choose_next(): - min_like = request.args.get('min_like', type=int) - choose_new_next(min_like) + min_like_num = request.args.get('min_like', type=int) + choose_new_next(min_like_num) return 'ok' app.register_blueprint(bp) diff --git a/templates/story.html b/templates/story.html index e4abc5b..fe4a54f 100644 --- a/templates/story.html +++ b/templates/story.html @@ -48,12 +48,9 @@