From 8bc837d281caac3f10ec56e0caddfee38f052a09 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Sat, 18 Dec 2021 03:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=AD=E5=BA=A6=E8=A1=B0=E5=87=8F=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hot_score_attenuation.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hot_score_attenuation.py diff --git a/hot_score_attenuation.py b/hot_score_attenuation.py new file mode 100644 index 0000000..9be26eb --- /dev/null +++ b/hot_score_attenuation.py @@ -0,0 +1,9 @@ +from hole import app +from models import Post, db + +with app.app_context(): + for p in Post.query.filter( + Post.hot_score > 0 + ).all(): + p.hot_score = int(p.hot_score * 0.9) + db.session.commit()