From 14d077725e68059c3dfb51bc14be6a6b003c1311 Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Fri, 5 Nov 2021 14:03:53 +0800 Subject: [PATCH] Revert "schedule" This reverts commit 6bd93e1e6bd8f766a55f1215dc31270d232d8b99. --- app.py | 15 +-------------- requirements.txt | 1 - static/css/ordinary.css | 3 ++- templates/story.html | 25 ++----------------------- 4 files changed, 5 insertions(+), 39 deletions(-) diff --git a/app.py b/app.py index ea569f5..edc1a35 100644 --- a/app.py +++ b/app.py @@ -7,9 +7,7 @@ from flask_sqlalchemy import SQLAlchemy from flask_limiter import Limiter from flask_limiter.util import get_remote_address from mastodon import Mastodon -from apscheduler.schedulers.background import BackgroundScheduler import random -import atexit from config import C WRONG_ANS_HTML = ''' @@ -105,17 +103,7 @@ def choose_new_next(min_like_num=10): story.tail = next_one.id next_one.is_chosen = True - # 更新 story! - db.session.commit() - -scheduler = BackgroundScheduler() -for d in range(5, 15): - for m in range(0, 24 * 60, C.period): - scheduler.add_job(func=choose_new_next, trigger='date', run_date=datetime(2021, 11, d, m // 60, m % 60), args=[1] if app.debug else []) -scheduler.start() - -# Shut down the scheduler when exiting the app -atexit.register(lambda: scheduler.shutdown()) + db.session.commit() def sample_question(qs, n=3): @@ -210,7 +198,6 @@ def story(story_id): cs_login_url = MAST_LOGIN_URL guest_login_url = url_for('main_bp.guest_login') verify_questions = sample_question(C.verify_questions) - period = C.period return render_template('story.html', **locals()) diff --git a/requirements.txt b/requirements.txt index 87178a5..b0a714a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -APScheduler~=3.8.1 Flask~=2.0.2 Flask_Limiter~=1.4 Flask_SQLAlchemy~=2.5.1 diff --git a/static/css/ordinary.css b/static/css/ordinary.css index 355b63d..4ee6b94 100644 --- a/static/css/ordinary.css +++ b/static/css/ordinary.css @@ -139,6 +139,7 @@ a:focus, .btn-link:focus { .paragraph-list { position: relative; margin: 40px 40px 30px 0; + background: white; } .show-mask { @@ -184,4 +185,4 @@ nav .page-link { nav .page-item.active .page-link { background-color: #000; border-color: #000; -} \ No newline at end of file +} diff --git a/templates/story.html b/templates/story.html index e30f986..e4abc5b 100644 --- a/templates/story.html +++ b/templates/story.html @@ -59,8 +59,8 @@
-
-

备选续写

+
+

备选后续

{% if sort_by == 'like' %} 按时间 | 按赞数 @@ -211,27 +211,6 @@ $('.user-info .btn').click(check_login); $('textarea').focus(check_login); - - function makeTimer() { - let period = $("#timeleft").data('period') * 60; - - var now = new Date(); - now = (Date.parse(now) / 1000); - - var timeLeft = period - now % period; - - var hours = Math.floor(timeLeft / 3600); - var minutes = Math.floor((timeLeft - (hours * 3600 )) / 60); - var seconds = Math.floor((timeLeft - (hours * 3600) - (minutes * 60))); - - if (hours < "10") { hours = "0" + hours; } - if (minutes < "10") { minutes = "0" + minutes; } - if (seconds < "10") { seconds = "0" + seconds; } - - $("#timeleft").html(`${hours}:${minutes}:${seconds}`); - } - - setInterval(function() { makeTimer(); }, 1000);