Skip to content

Commit

Permalink
fix: getting last_portfolio if project_Id is None
Browse files Browse the repository at this point in the history
  • Loading branch information
Romazes committed Jun 20, 2024
1 parent 1e97df5 commit 5bc6e2b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lean/components/util/live_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def _get_last_portfolio(api_client: APIClient, project_id: str, project_name: Pa
from json import loads
from datetime import datetime

cloud_deployment_list = api_client.get("live/read")
if not project_id:
# Project is not initialized in the cloud, hence project_id is None
return None

cloud_deployment_list = api_client.get("live/read", { "projectId": project_id })
cloud_deployment_time = [datetime.strptime(instance["launched"], "%Y-%m-%d %H:%M:%S").astimezone(UTC) for instance in cloud_deployment_list["live"]
if instance["projectId"] == project_id]
cloud_last_time = sorted(cloud_deployment_time, reverse = True)[0] if cloud_deployment_time else utc.localize(datetime.min)
Expand Down

0 comments on commit 5bc6e2b

Please sign in to comment.