diff --git a/files/helpers/lottery.py b/files/helpers/lottery.py index 619ee6e59e..6949c44926 100644 --- a/files/helpers/lottery.py +++ b/files/helpers/lottery.py @@ -12,7 +12,9 @@ def get_active_lottery(): def get_users_participating_in_lottery(): - return g.db.query(User).filter(User.currently_held_lottery_tickets > 0).all() + return g.db.query(User) \ + .filter(User.currently_held_lottery_tickets > 0) \ + .order_by(User.currently_held_lottery_tickets.desc()).all() def get_active_lottery_stats(): diff --git a/files/routes/lottery.py b/files/routes/lottery.py index ddaa83856b..241f58c238 100644 --- a/files/routes/lottery.py +++ b/files/routes/lottery.py @@ -52,3 +52,10 @@ def lottery_active(v): def lottery(v): lottery_stats, participant_stats = get_active_lottery_stats() return render_template("lottery.html", v=v, lottery_stats=lottery_stats, participant_stats=participant_stats) + +@app.get("/admin/lottery/participants") +@admin_level_required(2) +@lottery_required +def lottery_admin(v): + participants = get_users_participating_in_lottery() + return render_template("admin/lottery.html", v=v, participants=participants) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index b38fb03d97..3a04bf7312 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -46,6 +46,13 @@
  • Apps
  • +{% if LOTTERY_ENABLED -%} +

    Lottery

    + +{%- endif %} +

    Statistics