Skip to content

Commit

Permalink
Small fix 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz-Trela committed Mar 14, 2018
1 parent 98eb002 commit 6090e6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/plugins/apis/database_api/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ namespace last_votes_misc

uint32_t size = 0;
uint32_t skip = 0;
bool allow_skip = true;

//Gathering 'limit' data and sorting in-fly according to 'operator<' in 'WrapperType'.
while( size <= limit && itr != itr_u )
Expand All @@ -1194,11 +1195,14 @@ namespace last_votes_misc
}

//Find first item, which matches to 'v1' and 'v2' and 'v3'.
if( size == 0 )
if( allow_skip )
{
start = s.lower_bound( start_obj );
//Calculate what is offset between first saved data in 's' collection and first correct(!!!) data.
skip = std::distance( s.begin(), start );

//The variable 'skip' has to calculated only once.
allow_skip = false;
}

size = s.size() - skip;
Expand Down

0 comments on commit 6090e6d

Please sign in to comment.