From 68dbabfca4722fd367cea6d3cd5d1a114110cd0c Mon Sep 17 00:00:00 2001 From: LarsV04 Date: Fri, 23 Apr 2021 10:05:48 +0200 Subject: Fixed 15 --- api/rating.py | 8 +++++++- configure | 3 +-- nginx.conf | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/rating.py b/api/rating.py index cfdf5e4..17d52a2 100644 --- a/api/rating.py +++ b/api/rating.py @@ -1,4 +1,5 @@ from db import cursor +from ruleset import resolve_ruleset def outcome(outcome_str, player_1): @@ -12,7 +13,7 @@ def rating_v1(won_games): # python is a garbage language def get_all_games(user_id): - return cursor.execute("select player_1_id, player_2_id, outcome " + \ + return cursor.execute("select player_1_id, player_2_id, outcome, ruleset " + \ "from games " + \ "where (player_1_id = ? or player_2_id = ?) " + \ "and status = \"finished\" or status = \"resign\"", [user_id, user_id]).fetchall() @@ -29,6 +30,11 @@ def get_rating(user_id): ] counted_opponents = {} for game in mapped_games: + ruleset = resolve_ruleset(game[3]) + + if ruleset.ranked == False: + continue + # calculate sum score against user (+1 for win, -1 for lose, 0 for draw game) counted_opponents[game[1]] = (counted_opponents.get(game[1]) or 0) + { "w": 1, diff --git a/configure b/configure index b44b9cf..2fe466d 100755 --- a/configure +++ b/configure @@ -19,5 +19,4 @@ cd voerbak make cd .. -sed "s/user nobody/user $(whoami)/" -i ./nginx.conf - +sed "s/user nobody/user $(whoami)/" -i ./nginx.conf \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index f94cba2..21f664d 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,4 +1,4 @@ -user nobody; +user lars; daemon off; events {} -- cgit v1.2.3 From 6c1e9bd961eeee57828492a21f478675e15cb9aa Mon Sep 17 00:00:00 2001 From: LarsV04 Date: Fri, 23 Apr 2021 10:19:27 +0200 Subject: Fuck u --- configure | 2 +- nginx.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 2fe466d..624c2df 100755 --- a/configure +++ b/configure @@ -19,4 +19,4 @@ cd voerbak make cd .. -sed "s/user nobody/user $(whoami)/" -i ./nginx.conf \ No newline at end of file +sed "s/user nobody/user $(whoami)/" -i ./nginx.conf diff --git a/nginx.conf b/nginx.conf index 21f664d..f94cba2 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,4 +1,4 @@ -user lars; +user nobody; daemon off; events {} -- cgit v1.2.3