diff --git a/apigateway/get_missions/main.py b/apigateway/get_missions/main.py index a7e73f8..be31cdc 100644 --- a/apigateway/get_missions/main.py +++ b/apigateway/get_missions/main.py @@ -18,6 +18,7 @@ def process_mission(account_balance: int, mission_details: Mission) -> dict: "name": mission_details.data["name"], "strategy": mission_details.data["strategy"], "milestones": mission_details.calculate_milestones(account_balance), + "currentBalance": account_balance, } return payload diff --git a/apigateway/get_missions/requirements.txt b/apigateway/get_missions/requirements.txt index d07b788..255ad64 100644 --- a/apigateway/get_missions/requirements.txt +++ b/apigateway/get_missions/requirements.txt @@ -1623,5 +1623,5 @@ zipp==3.15.0 \ --extra-index-url https://us-east4-python.pkg.dev/development-380917/python-repos/simple/ -infra==0.1.108 \ +infra==0.1.109 \ --hash=sha256:d8964a8de539b848551bb1590ba3679dd9e2dbe89729135d67462d06575bfa0f diff --git a/infra/infra/data/missions.py b/infra/infra/data/missions.py index 332dc19..70ad953 100644 --- a/infra/infra/data/missions.py +++ b/infra/infra/data/missions.py @@ -5,7 +5,9 @@ class Mission: + # TODO: move to database level_step: dict = { + 0: 0, 200: 25, 1000: 50, 2500: 100, @@ -59,13 +61,21 @@ def forecaster(self, bins: int = 30) -> list: return new_df.values.tolist() def calculate_milestones(self, account_size: int) -> list[int]: - level = min( - self.level_step.keys(), key=lambda x: abs(x - account_size) + keys = list(self.level_step.keys()) + index = min( + range(len(keys)), key=lambda i: abs(keys[i] - account_size) ) + level = keys[index + 1] - print(level) + past_milestone = ( + account_size // self.level_step[level] + ) * self.level_step[level] - return [] + next_milestones = [ + past_milestone + (i + 1) * self.level_step[level] for i in range(3) + ] + + return [past_milestone, *next_milestones] class Missions: diff --git a/infra/pyproject.toml b/infra/pyproject.toml index 7abad18..e059ff1 100644 --- a/infra/pyproject.toml +++ b/infra/pyproject.toml @@ -14,7 +14,7 @@ license = {text = "MIT"} name = "infra" readme = "README.md" requires-python = ">=3.11" -version = "0.1.108" +version = "0.1.109" [build-system] build-backend = "pdm.backend"