mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
actually filter the tags
This commit is contained in:
parent
d666a6369e
commit
0919792d53
1 changed files with 6 additions and 0 deletions
|
@ -37,9 +37,15 @@ defmodule PhilomenaWeb.ProfileController do
|
|||
)
|
||||
|
||||
tags = tags(conn.assigns.user.public_links)
|
||||
|
||||
all_tag_ids =
|
||||
conn.assigns.user.verified_links
|
||||
|> tags()
|
||||
|> Enum.map(& &1.id)
|
||||
|
||||
watcher_counts =
|
||||
Tag
|
||||
|> where([t], t.id in ^all_tag_ids)
|
||||
|> join(:inner_lateral, [t], _ in fragment("SELECT count(*) FROM users WHERE watched_tag_ids @> ARRAY[?]", t.id))
|
||||
|> select([t, c], {t.id, c.count})
|
||||
|> Repo.all()
|
||||
|
|
Loading…
Reference in a new issue