From 74cfc655016cc760eacfea7ae3e5b4d911f761f2 Mon Sep 17 00:00:00 2001 From: Daochen Zha Date: Wed, 22 Jul 2020 00:59:20 -0500 Subject: [PATCH] Update page split --- README.md | 2 +- server/tournament/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d1898b9..dd88c9f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The definitions of the fields are as follows: | 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/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?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 | diff --git a/server/tournament/views.py b/server/tournament/views.py index 3b8ea5c..576cf90 100644 --- a/server/tournament/views.py +++ b/server/tournament/views.py @@ -49,7 +49,7 @@ def _get_page(result, elements_every_page, page_index): page_index = int(page_index) total_page = math.ceil(len(result) / float(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] return result, total_page