chinhodado / persona5_calculator

A tool to help calculate fusions in Persona 5.
https://chinhodado.github.io/persona5_calculator/
Apache License 2.0
326 stars 133 forks source link

Fix lastPage index calculation #64

Closed ronaldsmartin closed 3 years ago

ronaldsmartin commented 3 years ago

Fixes #63.

The computation of the lastPage index had an occasional off-by-one error when the page size evenly divided the number of recipes. The existing calculation worked most of the time because we were using Math.floor(), which was usually one less than the correct number of pages.

This fixes the calculation by correctly computing the total number of pages with Math.ceil() instead, and then making sure lastPage is always 0-indexed.

chinhodado commented 3 years ago

Thanks for this!