mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
link-view: in pagination logic, only +lent once
Also just use +swag instead of chaining +scag and +slag manually.
This commit is contained in:
parent
8f3d174c94
commit
4da0d636d3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user