Skip to content

Commit

Permalink
Subtracting offset instead of adding it.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed May 13, 2016
1 parent 49d9503 commit 4d853dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion gcloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@ def __iter__(self):
if self._limit is not None:
self._limit -= num_results
if self._offset is not None:
self._offset += num_results
# NOTE: The offset goes down relative to the location
# because we are updating the cursor each time.
self._offset -= num_results
self.next_page()


Expand Down
2 changes: 1 addition & 1 deletion gcloud/datastore/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def test___iter___w_limit(self):
qpb2 = _pb_from_query(query)
qpb2.start_cursor = self._END
qpb2.limit.value = 1
qpb2.offset = 14
qpb2.offset = 12
EXPECTED1 = {
'project': self._PROJECT,
'query_pb': qpb1,
Expand Down

0 comments on commit 4d853dc

Please sign in to comment.