fix: community search sql offset
This commit is contained in:
parent
39cd25f0cc
commit
52ac144953
2 changed files with 8 additions and 11 deletions
|
@ -52,18 +52,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-nest w-full">
|
<div class="card-nest w-full">
|
||||||
<div class="card small flex items-center justify-between gap-2">
|
<div class="card small flex items-center gap-2">
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
{{ icon "trending-up" }}
|
{{ icon "trending-up" }}
|
||||||
<span>{{ text "communities:label.popular_communities" }}</span>
|
<span>{{ text "communities:label.popular_communities" }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="/communities/search" class="button quaternary small">
|
|
||||||
{{ icon "search" }}
|
|
||||||
<span>{{ text "communities:label.search" }}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card flex flex-col gap-2">
|
<div class="card flex flex-col gap-2">
|
||||||
{% for item in popular_list %} {{
|
{% for item in popular_list %} {{
|
||||||
components::community_listing_card(community=item) }} {% endfor %}
|
components::community_listing_card(community=item) }} {% endfor %}
|
||||||
|
|
|
@ -161,7 +161,11 @@ impl DataManager {
|
||||||
let res = query_rows!(
|
let res = query_rows!(
|
||||||
&conn,
|
&conn,
|
||||||
"SELECT * FROM communities WHERE title LIKE $1 ORDER BY member_count DESC, created DESC LIMIT $2 OFFSET $3",
|
"SELECT * FROM communities WHERE title LIKE $1 ORDER BY member_count DESC, created DESC LIMIT $2 OFFSET $3",
|
||||||
params![&format!("%{query}%"), &(batch as i64), &(page as i64)],
|
params![
|
||||||
|
&format!("%{query}%"),
|
||||||
|
&(batch as i64),
|
||||||
|
&((page * batch) as i64)
|
||||||
|
],
|
||||||
|x| { Self::get_community_from_row(x) }
|
|x| { Self::get_community_from_row(x) }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue