divide + ceil = 81.1 ??

Options
Hi guys,
I'm quite confused with the ceil filter. It's supposed to round a decimal up to the next integer, but in my case, it doesn't. 🤷‍♂️
[image.png]
"total_pages" is initialized with the the value of the key "count" in the input "folder" (json). In this case, it's 811.
When I divide total_pages by 10 (the value of the per_page input) and add the ceil filter (plus a to_int), the value of total_pages becomes 81.1 😅

I've probably missed something, but what?

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    It sounds like you might be applying the ceiling filter to the value of 10, which you are dividing by instead of the result, which is now going to be the variable total_pages...

    You can always divide within filters (you don't need the function) so that you could do this all in 1 line on the function stack versus multiple.... it could look like this:

    [CleanShot 2021-11-03 at 11.53.14.png]