Update page split

This commit is contained in:
Daochen Zha 2020-07-22 00:59:20 -05:00
parent 87c5be2a26
commit 74cfc65501
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ The definitions of the fields are as follows:
| API | Description | | API | Description |
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| http://127.0.0.1:8000/tournament/launch?eval_num=200&name=leduc-holdem | Evaluate on Leduc Holdem with 200 games for each pair of models | | http://127.0.0.1:8000/tournament/launch?eval_num=200&name=leduc-holdem | Evaluate on Leduc Holdem with 200 games for each pair of models |
| http://127.0.0.1:8000/tournament/replay?name=leduc-holdem&agent0=leduc-holdem-rule-v1&agent1=leduc-holdem-cfr &index=3 | Obtain the replay data between rule model and CFR model. Obtain the data of the 3rd game | | http://127.0.0.1:8000/tournament/replay?name=leduc-holdem&agent0=leduc-holdem-rule-v1&agent1=leduc-holdem-cfr&index=3 | Obtain the replay data between rule model and CFR model. Obtain the data of the 3rd game |
| http://127.0.0.1:8000/tournament/query_game&elements_every_page=10&page_index=0 | Get all the game data | | http://127.0.0.1:8000/tournament/query_game&elements_every_page=10&page_index=0 | Get all the game data |
| http://127.0.0.1:8000/tournament/query_game?name=leduc-holdem&elements_every_page=10&page_index=0 | Get all the game data of Leduc Holdem | | http://127.0.0.1:8000/tournament/query_game?name=leduc-holdem&elements_every_page=10&page_index=0 | Get all the game data of Leduc Holdem |
| http://127.0.0.1:8000/tournament/query_payoff | Get all the payoffs | | http://127.0.0.1:8000/tournament/query_payoff | Get all the payoffs |

View File

@ -49,7 +49,7 @@ def _get_page(result, elements_every_page, page_index):
page_index = int(page_index) page_index = int(page_index)
total_page = math.ceil(len(result) / float(elements_every_page)) total_page = math.ceil(len(result) / float(elements_every_page))
begin = page_index * elements_every_page begin = page_index * elements_every_page
end = min((page_index+1) * elements_every_page, total_page) end = min((page_index+1) * elements_every_page, len(result))
result = result[begin:end] result = result[begin:end]
return result, total_page return result, total_page