From 4da0d636d3c89a1a7178821d857651154583fdff Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 13 Apr 2020 21:26:44 +0200 Subject: [PATCH] link-view: in pagination logic, only +lent once Also just use +swag instead of chaining +scag and +slag manually. --- pkg/arvo/app/link-view.hoon | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/app/link-view.hoon b/pkg/arvo/app/link-view.hoon index 506113f002..b7c46a00fb 100644 --- a/pkg/arvo/app/link-view.hoon +++ b/pkg/arvo/app/link-view.hoon @@ -161,15 +161,16 @@ :: ++ page-size 25 ++ get-paginated - |* [p=(unit @ud) l=(list)] - ^- [total=@ud pages=@ud page=_l] - :+ (lent l) - %+ add (div (lent l) page-size) - (min 1 (mod (lent l) page-size)) - ?~ p l - %+ scag page-size - %+ slag (mul u.p page-size) - l + |* [page=(unit @ud) list=(list)] + ^- [total=@ud pages=@ud page=_list] + =/ l=@ud (lent list) + :+ l + %+ add (div l page-size) + (min 1 (mod l page-size)) + ?~ page list + %+ swag + [(mul u.page page-size) page-size] + list :: ++ page-to-json =, enjs:format