limit check added
This commit is contained in:
parent
895fbec5bc
commit
6b2927a693
1 changed files with 5 additions and 3 deletions
|
|
@ -1804,6 +1804,7 @@ vector<tournament_object> database_api_impl::get_tournaments(tournament_id_type
|
||||||
vector<tournament_object> result;
|
vector<tournament_object> result;
|
||||||
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
|
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
|
||||||
for (auto elem: tournament_idx) {
|
for (auto elem: tournament_idx) {
|
||||||
|
if( result.size() >= limit ) break;
|
||||||
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
|
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
|
||||||
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()))
|
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()))
|
||||||
result.push_back( elem );
|
result.push_back( elem );
|
||||||
|
|
@ -1829,6 +1830,7 @@ vector<tournament_object> database_api_impl::get_tournaments_by_state(tournament
|
||||||
vector<tournament_object> result;
|
vector<tournament_object> result;
|
||||||
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
|
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
|
||||||
for (auto elem: tournament_idx) {
|
for (auto elem: tournament_idx) {
|
||||||
|
if( result.size() >= limit ) break;
|
||||||
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
|
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
|
||||||
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()) &&
|
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()) &&
|
||||||
elem.get_state() == state )
|
elem.get_state() == state )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue