posted by setec_astronomy on Tue 14th Oct 2008 12:08
Conversations I'm probably the only one left using flat comment view with 10 comments per page. When discussions approach 100 comments, there seems to be a glitch with calculating the offset for the last page.

Example: Url to access comment page 10 when exactly 100 comments were filed:

http://osnews.com/comments/20381?view=flat&threshold=0&sort=comment...

Obviously, the correct offset should be 90. Moreover, for situations with a total number of lets say 98 comments, the URL string reads like

http://osnews.com/comments/20381?view=flat&threshold=0&sort=comment...

, e.g. the calculation of the offset yields sometimes bogus results, probably depending on the total number of comments.

(Bug is reproducible with epiphany, arora and firefox under arch linux)

Thanks in advance
Previous ConversationNext Conversation
Comments:
Clarification
by setec_astronomy on Fri 17th Oct 2008 10:02 UTC
setec_astronomy
Member since:
2007-11-17

In order to clarify my bug report from above, please consider this situation:

The "C++: The Ugly Useful Programming Language" article currently has 101 comments. Using my preference settings (flat view, oldest first, 10 comments per page) and clicking on the [10] button, I get thispage with meager 2 comments :

http://osnews.com/comments/20381/?view=flat&threshold=0&sort=commen...

Question 1: Why is the offset 99?
If I would have to implement such a pager (in fact: I have done so many times in the past), I would use something along the lines of

offset = min( ( pagenumber - 1 ) * comments per page, total number of comments )

which would yield offset=90 for the tenth page.
Note that manually changing the offset value in the URL fixes the problem and yields the page with the expected 10 comments (numbers 91 - 100, to be precise):

http://osnews.com/comments/20381/?view=flat&threshold=0&sort=commen...

Is this a bug? Am I stupid?

Any comments would be very appreciated, thanks in advance.

Reply Score: 1