fix: duplicate rule when query by page
This commit is contained in:
parent
b7bcb9ea11
commit
91a7022e83
|
@ -98,11 +98,12 @@ node_query(Node, Params, {Tab, QsSchema}, QueryFun, SortFun) ->
|
||||||
true -> Meta#{count => count(Tab), hasnext => length(Rows) > Limit};
|
true -> Meta#{count => count(Tab), hasnext => length(Rows) > Limit};
|
||||||
_ -> Meta#{count => -1, hasnext => length(Rows) > Limit}
|
_ -> Meta#{count => -1, hasnext => length(Rows) > Limit}
|
||||||
end,
|
end,
|
||||||
NRows = case SortFun of
|
Data0 = lists:sublist(Rows, Limit),
|
||||||
undefined -> Rows;
|
Data = case SortFun of
|
||||||
_ -> lists:sort(SortFun, Rows)
|
undefined -> Data0;
|
||||||
end,
|
_ -> lists:sort(SortFun, Data0)
|
||||||
#{meta => NMeta, data => lists:sublist(NRows, Limit)}.
|
end,
|
||||||
|
#{meta => NMeta, data => Data}.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
do_query(Node, Qs, {M,F}, Start, Limit) when Node =:= node() ->
|
do_query(Node, Qs, {M,F}, Start, Limit) when Node =:= node() ->
|
||||||
|
|
Loading…
Reference in New Issue