From 2983c00c7473ad2a7347c9880f103b181f00f91b Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Thu, 11 Jun 2020 17:18:52 +0200 Subject: [PATCH] problem with pagination when a number of items in result matches the display size (#89) fixes #84 --- src/Search.elm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Search.elm b/src/Search.elm index d3b7fc5..dcf1138 100644 --- a/src/Search.elm +++ b/src/Search.elm @@ -482,12 +482,20 @@ viewPager outMsg model result path = "#disabled" else + let + remainder = + if remainderBy model.size result.hits.total.value == 0 then + 1 + + else + 0 + in createUrl path model.channel model.query model.show - ((result.hits.total.value // model.size) * model.size) + (((result.hits.total.value // model.size) - remainder) * model.size) model.size ] [ text "Last" ]