Add a bell curve graph and total points calculation (#1325)

* Add a bell curve graph and total points calculation to admin panel statistics
* Closes #608
This commit is contained in:
Kevin Chung
2020-04-17 03:10:55 -04:00
committed by GitHub
parent ccefe47468
commit cd6439f2eb
10 changed files with 153 additions and 2 deletions

View File

@@ -31,6 +31,13 @@ def statistics():
challenge_count = Challenges.query.count()
total_points = (
Challenges.query.with_entities(db.func.sum(Challenges.value).label("sum"))
.filter_by(state="visible")
.first()
.sum
) or 0
ip_count = Tracking.query.with_entities(Tracking.ip).distinct().count()
solves_sub = (
@@ -73,6 +80,7 @@ def statistics():
wrong_count=wrong_count,
solve_count=solve_count,
challenge_count=challenge_count,
total_points=total_points,
solve_data=solve_data,
most_solved=most_solved,
least_solved=least_solved,