Skip to content

Commit

Permalink
[Community] avoid error on missing current portfolio id
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Oct 29, 2023
1 parent be16844 commit c0d96b6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ async def update_bot_config_and_stats(self, profitability):
formatted_portfolio = formatters.format_portfolio_with_profitability(profitability)
if self.user_account.get_selected_bot_current_portfolio_id() is None:
await self.refresh_selected_bot()
formatted_portfolio[backend_enums.PortfolioKeys.ID.value] = \
self.user_account.get_selected_bot_current_portfolio_id()
await self.supabase_client.update_portfolio(formatted_portfolio)
if self.user_account.get_selected_bot_current_portfolio_id() is None:
self.logger.debug(
f"Skipping portfolio update: current bot {self.user_account.bot_id} has no current portfolio_id"
)
else:
formatted_portfolio[backend_enums.PortfolioKeys.ID.value] = \
self.user_account.get_selected_bot_current_portfolio_id()
await self.supabase_client.update_portfolio(formatted_portfolio)

0 comments on commit c0d96b6

Please sign in to comment.