|
@ -22,6 +22,9 @@ WRONG_ANS_HTML = ''' |
|
|
</html> |
|
|
</html> |
|
|
''' |
|
|
''' |
|
|
|
|
|
|
|
|
|
|
|
MIN_LIKE_NUM = 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
app = Flask(__name__) |
|
|
app.config.from_object('config.C') |
|
|
app.config.from_object('config.C') |
|
|
app.secret_key = C.session_key |
|
|
app.secret_key = C.session_key |
|
@ -92,7 +95,7 @@ class Reaction(db.Model): |
|
|
user = db.Column(db.String(30)) # username of user |
|
|
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(): |
|
|
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)\ |
|
|
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') |
|
|
guest_login_url = url_for('main_bp.guest_login') |
|
|
verify_questions = sample_question(C.verify_questions) |
|
|
verify_questions = sample_question(C.verify_questions) |
|
|
|
|
|
|
|
|
|
|
|
min_like_num = MIN_LIKE_NUM |
|
|
|
|
|
email = C.email |
|
|
|
|
|
|
|
|
return render_template('story.html', **locals()) |
|
|
return render_template('story.html', **locals()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -260,8 +266,8 @@ def react(): |
|
|
|
|
|
|
|
|
@bp.route('/choose') |
|
|
@bp.route('/choose') |
|
|
def choose_next(): |
|
|
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' |
|
|
return 'ok' |
|
|
|
|
|
|
|
|
app.register_blueprint(bp) |
|
|
app.register_blueprint(bp) |
|
|