only show tags which do not have the tag yet
This commit is contained in:
parent
26bcc7d383
commit
71d57cafd1
|
@ -63,6 +63,7 @@ defmodule Chiya.Notes do
|
|||
|> where([n], fragment("? ~ ?", n.name, ^tag.regex))
|
||||
|> or_where([n], fragment("? ~ ?", n.url, ^tag.regex))
|
||||
|> or_where([n], fragment("? ~ ?", n.content, ^tag.regex))
|
||||
|> preload(^@preloads)
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,18 @@ defmodule ChiyaWeb.TagController do
|
|||
|
||||
def apply_prepare(conn, %{"id" => id}) do
|
||||
tag = Tags.get_tag!(id)
|
||||
notes = Chiya.Notes.list_apply_notes(tag)
|
||||
|
||||
notes =
|
||||
tag
|
||||
|> Chiya.Notes.list_apply_notes()
|
||||
|> Enum.filter(fn note ->
|
||||
exists =
|
||||
note.tags
|
||||
|> Enum.map(fn t -> t.name end)
|
||||
|> Enum.member?(tag.name)
|
||||
|
||||
!exists
|
||||
end)
|
||||
|
||||
render(conn, :apply_prepare, tag: tag, notes: notes)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue