|
|
@ -22,6 +22,9 @@ WRONG_ANS_HTML = ''' |
|
|
|
</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) |
|
|
|