Skip to content

Commit

Permalink
Fix preferences handler bug + dataclass repr (#4468)
Browse files Browse the repository at this point in the history
* move tradier to data providers

* fix handlers
  • Loading branch information
montezdesousa authored and jmaslek committed Apr 12, 2023
1 parent 294dffa commit c3eed53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions openbb_terminal/core/session/credentials_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ def set_credential(
sync_enabled = current_user.preferences.SYNC_ENABLED
local_user = is_local()

if persist and local_user:
set_key(str(SETTINGS_ENV_FILE), name, str(value))

# Remove "OPENBB_" prefix from env_var
if name.startswith("OPENBB_"):
name = name[7:]
Expand All @@ -66,6 +63,10 @@ def set_credential(
updated_user = dataclasses.replace(current_user, credentials=updated_credentials)
set_current_user(updated_user)

# Set credential in local env file
if persist and local_user:
set_key(str(SETTINGS_ENV_FILE), name, str(value))

# Send credential to cloud
if (
not local_user
Expand Down
7 changes: 4 additions & 3 deletions openbb_terminal/core/session/preferences_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def set_preference(
current_user = get_current_user()
local_user = is_local()

if local_user:
set_key(str(SETTINGS_ENV_FILE), name, str(value))

# Remove "OPENBB_" prefix from env_var
if name.startswith("OPENBB_"):
name = name[7:]
Expand All @@ -48,6 +45,10 @@ def set_preference(
updated_user = dataclasses.replace(current_user, preferences=updated_preferences)
set_current_user(updated_user)

# Set preference in local env file
if local_user:
set_key(str(SETTINGS_ENV_FILE), name, str(value))

# Send preference to cloud
if not login and (not local_user or name == "OPENBB_SYNC_ENABLED"):
patch_user_configs(
Expand Down

0 comments on commit c3eed53

Please sign in to comment.