mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
link-server-hook: include item count with page count
This commit is contained in:
parent
740836348d
commit
df2ed4b5a6
@ -239,8 +239,9 @@
|
|||||||
++ page-size 25
|
++ page-size 25
|
||||||
++ get-paginated
|
++ get-paginated
|
||||||
|* [l=(list) p=(unit @ud)]
|
|* [l=(list) p=(unit @ud)]
|
||||||
^- [pages=@ud page=_l]
|
^- [total=@ud pages=@ud page=_l]
|
||||||
:- +((div (lent l) page-size))
|
:+ (lent l)
|
||||||
|
+((div (lent l) page-size))
|
||||||
?~ p l
|
?~ p l
|
||||||
%+ scag page-size
|
%+ scag page-size
|
||||||
%+ slag (mul u.p page-size)
|
%+ slag (mul u.p page-size)
|
||||||
@ -248,16 +249,19 @@
|
|||||||
::
|
::
|
||||||
++ page-to-json
|
++ page-to-json
|
||||||
=, enjs:format
|
=, enjs:format
|
||||||
|* [[total-pages=@ud page=(list)] item-to-json=$-(* json)]
|
|* $: [total-items=@ud total-pages=@ud page=(list)]
|
||||||
|
item-to-json=$-(* json)
|
||||||
|
==
|
||||||
^- json
|
^- json
|
||||||
%- pairs
|
%- pairs
|
||||||
:~ 'total-pages'^(numb total-pages)
|
:~ 'total-items'^(numb total-items)
|
||||||
|
'total-pages'^(numb total-pages)
|
||||||
'page'^a+(turn page item-to-json)
|
'page'^a+(turn page item-to-json)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ get-submissions
|
++ get-submissions
|
||||||
|= [=path p=(unit @ud)]
|
|= [=path p=(unit @ud)]
|
||||||
^- [@ud submissions]
|
^- [@ud @ud submissions]
|
||||||
=- (get-paginated - p)
|
=- (get-paginated - p)
|
||||||
.^ submissions
|
.^ submissions
|
||||||
%gx
|
%gx
|
||||||
@ -270,7 +274,7 @@
|
|||||||
::
|
::
|
||||||
++ get-local-pages
|
++ get-local-pages
|
||||||
|= [=path p=(unit @ud)]
|
|= [=path p=(unit @ud)]
|
||||||
^- [@ud pages]
|
^- [@ud @ud pages]
|
||||||
=- (get-paginated - p)
|
=- (get-paginated - p)
|
||||||
.^ pages
|
.^ pages
|
||||||
%gx
|
%gx
|
||||||
@ -283,7 +287,7 @@
|
|||||||
::
|
::
|
||||||
++ get-discussions
|
++ get-discussions
|
||||||
|= [=path p=(unit @ud)]
|
|= [=path p=(unit @ud)]
|
||||||
^- [@ud comments]
|
^- [@ud @ud comments]
|
||||||
=- (get-paginated - p)
|
=- (get-paginated - p)
|
||||||
.^ comments
|
.^ comments
|
||||||
%gx
|
%gx
|
||||||
|
Loading…
Reference in New Issue
Block a user