Skip to content

Commit

Permalink
settings: SUPPORTED_GAMETYPES -> ENABLED_GAMETYPES
Browse files Browse the repository at this point in the history
  • Loading branch information
em92 committed Jan 14, 2023
1 parent 2341ec3 commit 0af8298
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions qllr/blueprints/balance_api/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from qllr.db import cache
from qllr.settings import (
AVG_PERF_GAMETYPES,
ENABLED_GAMETYPES,
INITIAL_R1_MEAN,
INITIAL_R2_VALUE,
SUPPORTED_GAMETYPES,
)
from qllr.submission import get_map_id

Expand Down Expand Up @@ -107,7 +107,7 @@ async def fetch(
players = {}
for steam_id in map(str, steam_ids):
players[steam_id] = {"steamid": steam_id}
for gametype in SUPPORTED_GAMETYPES:
for gametype in ENABLED_GAMETYPES:
players[steam_id][gametype] = {
"games": 0,
"elo": INITIAL_R1_MEAN[gametype]
Expand Down
11 changes: 7 additions & 4 deletions qllr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

config = Config(".env")

SUPPORTED_GAMETYPES = ("ad", "ca", "ctf", "ft", "tdm", "tdm2v2")
ENABLED_GAMETYPES = config(
"ENABLED_GAMETYPES", cast=CommaSeparatedStrings, default=list(GAMETYPE_RULES.keys())
)
DATABASE_URL = str(config("DATABASE_URL", cast=URL))
HOST = config("HOST", default="127.0.0.1")
PORT = config("PORT", cast=int, default=7081)
Expand All @@ -21,8 +23,9 @@
INITIAL_R1_DEVIATION = {}
MIN_PLAYER_COUNT_IN_MATCH_TO_RATE = {}
USE_AVG_PERF = {}
for gt in SUPPORTED_GAMETYPES:
MIN_PLAYER_COUNT_IN_MATCH_TO_RATE[gt] = config(
for gt in ENABLED_GAMETYPES:
rules = GAMETYPE_RULES[gt]
MIN_PLAYER_COUNT_IN_MATCH_TO_RATE[gt] = rules.override_min_player_count() or config(
"MIN_PLAYER_COUNT_IN_MATCH_TO_RATE_{}".format(gt.upper()), cast=int, default=6
)
USE_AVG_PERF[gt] = config(
Expand All @@ -37,4 +40,4 @@

INITIAL_R2_VALUE = INITIAL_R1_MEAN.copy()

AVG_PERF_GAMETYPES = [gt for gt in SUPPORTED_GAMETYPES if USE_AVG_PERF[gt]]
AVG_PERF_GAMETYPES = [gt for gt in ENABLED_GAMETYPES if USE_AVG_PERF[gt]]

0 comments on commit 0af8298

Please sign in to comment.