fix DetachedInstanceError on /admin/statistics (#133)

see http://stackoverflow.com/questions/15397680/detaching-sqlalchemy-instance-so-no-refresh-happens
This commit is contained in:
wangxiyu191
2016-07-28 12:00:45 +08:00
committed by Kevin Chung
parent 011e2c33c3
commit 70a0245e89

View File

@@ -733,7 +733,8 @@ def admin_stats():
least_solved_chal = Challenges.query.add_columns(solves_cnt) \
.outerjoin(solves_sub, solves_sub.columns.chalid == Challenges.id) \
.order_by(solves_cnt.asc()).first()
db.session.expunge_all()
db.session.commit()
db.session.close()