Closed sunnydl closed 2 years ago
since we are currently only retrieving data straight from the riot, ima set the max to 10, since it only returns the max 10 games. Once we set it up to retrieve from the database, I can set it to 20.
@erlyu There should be an option for the riotApi to set how many to retrieve, right now you are retrieving the same amount from riotApi and pushing them to a list, which is not what we want (we want the data straight from API, if you get 10 every time we want 3 or 5, it will be inefficient). We will actually be using this without DB for now so you can start setting it up.
Basically when u call riot API, u can pass in a param in Axios call with the field name of count
, specifying how many matches to be returned by the api. For the implementation of param in Axios, you can reference line 44-49 of /frontend/src/redux/slices/user.ts
. Hope this helps.
So u need to modify the findMatchHistoryInfo
in /backend/riotApis/riotApis.ts
as well
@erlyu Could you change it so that it check the numOfMatch first before requesting from riotApi? Cuz right now if numOfMatch is 50, then it will fetch 50 first then do the condition check, which is not efficient. But if you check the numOfMatch first and see it is 50, u can just pass 20 to the findMatchHistoryInfo, so that it makes sure the cap is 20.
@erlyu
we should also be able to specify the type of match to fetch from riot API, I think the "type" here is the parameter field we need to fill in.
so modify the riot API caller function to be able to fetch the type of match specified.
Seems like thats it for this issue, will close it now
Modify the function that is used to get matchIds from riotApi in matchService to take in a parameter, which would indicate how many matches to fetch from riot API.
for example
Inside the function, make the limit of num to 20. So if num comes in greater than 20, for example 30, use value 20 instead since 20 is the cap. If not greater than 20, then use whatever value num is holding.