codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
385 stars 69 forks source link

Post history pagination & permalinks #1230

Open Oaphi opened 10 months ago

Oaphi commented 10 months ago

Closes #1229

trichoplax commented 3 months ago

I'm not familiar with Rails' pagination functionality so I don't know how to completely fix this, but just in case it helps I believe the numbering of the edits can be calculated using information which already seems to be available:

If you know the number of an item within the current page (from 1 to per_page), say number_in_page, then the number to display (the edit number) can be calculated as:

@count - (number_in_page - 1) - (@page - 1) * per_page

The 1s are due to number_in_page and @page being 1-indexed rather than 0-indexed. They can be omitted if those variables are actually 0-indexed.