Skip to content

Commit 77c4b73

Browse files
author
Oleksii Korshenko
authored
MAGETWO-86728: Ranged selects always miss the last range #12624
2 parents dc54a26 + 6a50929 commit 77c4b73

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function __construct(
113113
public function current()
114114
{
115115
if (null === $this->currentSelect) {
116-
$this->isValid = ($this->currentOffset + $this->batchSize) <= $this->totalItemCount;
116+
$this->isValid = $this->currentOffset < $this->totalItemCount;
117117
$this->currentSelect = $this->initSelectObject();
118118
}
119119
return $this->currentSelect;
@@ -144,7 +144,7 @@ public function next()
144144
if (null === $this->currentSelect) {
145145
$this->current();
146146
}
147-
$this->isValid = ($this->batchSize + $this->currentOffset) <= $this->totalItemCount;
147+
$this->isValid = $this->currentOffset < $this->totalItemCount;
148148
$select = $this->initSelectObject();
149149
if ($this->isValid) {
150150
$this->iteration++;

lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ public function testIterations()
116116
$iterations++;
117117
}
118118

119-
$this->assertEquals(10, $iterations);
119+
$this->assertEquals(11, $iterations);
120120
}
121121
}

0 commit comments

Comments
 (0)