[MGNLSTK-744] Paging broken due to wrong offset calculation Created: 11/Feb/11 Updated: 09/Aug/12 Resolved: 17/Feb/11 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 1.4.2 |
| Fix Version/s: | 1.4.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Frank Rittinger | Assignee: | Ondrej Chytil |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
all systems |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||
| Patch included: |
Yes
|
||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||
| Description |
|
STKPager calculates wrong sublist for display due to an error in the offset calculation. This was introduced by the update from 1.4.1 to 1.4.2: protected int getOffset() {
int offset = ((getCurrentPage()) * maxResultsPerPage) -1;
if(offset > count) {
int pages = count / maxResultsPerPage;
offset = pages * maxResultsPerPage;
}
return offset;
}
should be protected int getOffset() {
int offset = (getCurrentPage() - 1) * maxResultsPerPage;
if(offset > count) {
int pages = count / maxResultsPerPage;
offset = pages * maxResultsPerPage;
}
return offset;
}
|
| Comments |
| Comment by Magnolia International [ 11/Feb/11 ] |
|
Thanks for the report and patch, Frank ! |
| Comment by Ondrej Chytil [ 11/Feb/11 ] |
|
Yes, actually it's necessary because I was not able to reproduce it on demo-project. |