mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Merge pull request #9773 from jakemcdermott/fix-9772
Fix rounding error in output pagination controls for #9772 Reviewed-by: Jake McDermott <yo@jakemcdermott.me> Reviewed-by: Kersom <None> Reviewed-by: Tiago Góes <tiago.goes2009@gmail.com>
This commit is contained in:
commit
5eae035f60
@ -6,7 +6,7 @@ export default function getRowRangePageSize(startIndex, stopIndex) {
|
||||
page = startIndex + 1;
|
||||
pageSize = 1;
|
||||
} else if (stopIndex >= startIndex + 50) {
|
||||
page = Math.ceil(startIndex / 50);
|
||||
page = Math.floor(startIndex / 50) + 1;
|
||||
pageSize = 50;
|
||||
} else {
|
||||
for (let i = stopIndex - startIndex + 1; i <= 50; i++) {
|
||||
|
||||
@ -29,4 +29,11 @@ describe('getRowRangePageSize', () => {
|
||||
firstIndex: 5,
|
||||
});
|
||||
});
|
||||
test('handles range with 0 startIndex', () => {
|
||||
expect(getRowRangePageSize(0, 50)).toEqual({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
firstIndex: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user