From 7e851f38dba2dfdef4b6c14b5a9d50ada457afeb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 01:59:25 +0200 Subject: [PATCH] fdssdf --- docker-compose.yml | 2 +- files/routes/admin.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 935a2e48b..38d404a12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - "./:/service" environment: - DATABASE_URL=postgresql://postgres@postgres:5432 - - MASTER_KEY=${MASTER_KEY:XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY} + - MASTER_KEY=XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY - REDIS_URL=redis://redis - DOMAIN=127.0.0.1 - SITE_NAME=Drama diff --git a/files/routes/admin.py b/files/routes/admin.py index fef4d94f7..fc6a38e20 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -19,14 +19,13 @@ from files.helpers.discord import add_role SITE_NAME = environ.get("SITE_NAME", "").strip() -@app.get("/votes2") +@app.get("/upvoters/") @admin_level_required(6) -def votes2(v): - votes = g.db.query(Votes).join(Submission, Vote.submission_id==Submission.id).filter(Submission.author_id==7)all() - li = [] - for v in votes: - li.append(v.user_id) - return(str(li)) +def votes2(v, id): + try: id = int(id) + except: abort(400) + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).all() + return(str(votes))