Page MenuHomePhabricator

Special:PageAssessments with specified limit is off by one
Closed, ResolvedPublic2 Story Points

Description

Special:PageAssessments with a specified limit is off by one. For example: https://en.wikipedia.org/wiki/Special:PageAssessments?project=&namespace=2&page_title=&limit=2 shows three results, even though limit=2 is specified.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 22 2017, 4:29 AM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptJun 22 2017, 4:30 AM
kaldari set the point value for this task to 2.Jun 27 2017, 11:16 PM
kaldari triaged this task as Normal priority.

It is specifically mentioned here (https://github.com/wikimedia/mediawiki-extensions-PageAssessments/blob/68c5a3f7921abe9f923b85d8129bd3709dbd76ac/api/ApiQueryPageAssessments.php#L29) that projects will be displayed always one more than the limit. Should we change it?

kaldari added a subscriber: kaldari.EditedJul 11 2017, 12:29 AM

To fix this, the while loop in SpecialPage::outputResults() should be changed to a for loop that only goes up to $num:

for ( $i = 0; $i < $num && $row = $res->fetchObject(); $i++ ) {
kaldari assigned this task to dmaza.Jul 11 2017, 12:36 AM
kaldari edited projects, added Community-Tech-Sprint; removed Community-Tech.

Change 364912 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/extensions/PageAssessments@master] Fix Special:PageAssessments limit bug

https://gerrit.wikimedia.org/r/364912

Change 364912 merged by jenkins-bot:
[mediawiki/extensions/PageAssessments@master] Fix Special:PageAssessments limit bug

https://gerrit.wikimedia.org/r/364912

kaldari closed this task as Resolved.Jul 13 2017, 4:52 AM
kaldari moved this task from Needs Review/Feedback to Q1 2018-19 on the Community-Tech-Sprint board.