Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed Feb 3, 2024
1 parent 9c15f7c commit f903f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ async def manual_startup(secret: str):
logger.info("new day")
id, today = 0, date.today()

hiscores = await req.get_prediction_data(id=id, limit=config.BATCH_AMOUNT)
hiscores = await req.get_prediction_data(
player_id=id, limit=config.BATCH_AMOUNT
)
_highscores = hiscores[-1]
logger.info(_highscores)
id = _highscores.get("id")
id = _highscores.get("Player_id")
hiscores = pd.DataFrame(hiscores)

if len(hiscores) == 0:
Expand Down
8 changes: 4 additions & 4 deletions api/cogs/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def get_player_data(label_id: int, limit: int = 5000):

async def get_hiscore_data(label_id: int, limit: int = 5000):
url = "http://private-api-svc.bd-prd.svc:5000/v2/highscore/latest" # TODO: fix hardcoded
params = {"player_id": 1, "many": 1, "limit": limit}
params = {"player_id": 1, "label_id": label_id, "many": 1, "limit": limit}

# Initialize a list to store hiscore data
hiscores = []
Expand All @@ -113,14 +113,14 @@ async def get_hiscore_data(label_id: int, limit: int = 5000):
break

# Increment the page parameter for the next request
params["player_id"] = data[-1]["id"]
params["player_id"] = data[-1]["Player_id"]

return hiscores


async def get_prediction_data(id: int = 0, limit: int = 0):
async def get_prediction_data(player_id: int = 0, limit: int = 0):
url = "http://private-api-svc.bd-prd.svc:5000/v2/highscore/latest" # TODO: fix hardcoded
params = {"player_id": id, "many": 1, "limit": limit}
params = {"player_id": player_id, "many": 1, "limit": limit}

data = await retry_request(url=url, params=params)
return data
Expand Down

0 comments on commit f903f5f

Please sign in to comment.