[odrs-web/oscp] Allow deleting a lot of reviews
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web/oscp] Allow deleting a lot of reviews
- Date: Thu, 17 Mar 2022 14:30:48 +0000 (UTC)
commit d9e7ece34fdcef020e588665576cfa6351834ca1
Author: Richard Hughes <richard hughsie com>
Date: Thu Mar 17 14:30:32 2022 +0000
Allow deleting a lot of reviews
app_data/cron.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/app_data/cron.py b/app_data/cron.py
index d6e7c9f..8692ae0 100755
--- a/app_data/cron.py
+++ b/app_data/cron.py
@@ -89,14 +89,15 @@ def _fsck_components():
def _auto_delete(days=31):
# delete all reviews with taboo, otherwise the moderatorators get overwhelmed
- for review in (
- db.session.query(Review)
+ for (review_id,) in (
+ db.session.query(Review.review_id)
.filter(Review.reported == 5)
.order_by(Review.date_created.asc())
.limit(1000)
):
+ review = db.session.query(Review).filter(Review.review_id == review_id).first()
db.session.delete(review)
- db.session.commit()
+ db.session.commit()
# clean up all old deleted reviews
since = datetime.datetime.now() - datetime.timedelta(days=days)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]