diff options
Diffstat (limited to 'api/user/preferences.py')
-rw-r--r-- | api/user/preferences.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/api/user/preferences.py b/api/user/preferences.py index 2feaade..2ca4a05 100644 --- a/api/user/preferences.py +++ b/api/user/preferences.py @@ -8,15 +8,15 @@ import json # fill missing dict keys in preferences object def format_preferences(prefs): return { - "darkMode": - prefs.get("darkMode") or False, - "ruleset": - resolve_ruleset(json.dumps(prefs.get("ruleset") or {}) or "default"), - "userColors": { - "diskA": prefs.get("userColors", {}).get("diskA") or "", - "diskB": prefs.get("userColors", {}).get("diskB") or "", - "background": prefs.get("userColors", {}).get("background") or "" - } + "darkMode": + prefs.get("darkMode") or False, + "ruleset": + resolve_ruleset(json.dumps(prefs.get("ruleset") or {}) or "default"), + "userColors": { + "diskA": prefs.get("userColors", {}).get("diskA") or "", + "diskB": prefs.get("userColors", {}).get("diskB") or "", + "background": prefs.get("userColors", {}).get("background") or "" + } } @@ -27,7 +27,7 @@ preferences = Blueprint('preferences', __name__) @auth_required("user") def get_preferences(login): user_prefs = cursor.execute( - "select preferences from users where user_id = ?", [login] + "select preferences from users where user_id = ?", [login] ).fetchone() return {"preferences": format_preferences(json.loads(user_prefs[0]))}, 200 @@ -41,8 +41,8 @@ def index(login): formatted_json = format_preferences(new_preferences) cursor.execute( - "update users set preferences = ? where user_id = ?", - [json.dumps(formatted_json), login] + "update users set preferences = ? where user_id = ?", + [json.dumps(formatted_json), login] ) connection.commit() |