count correctly

This commit is contained in:
byte[] 2019-12-14 18:12:00 -05:00
parent 482f1dfe5e
commit b62a723efe
2 changed files with 1 additions and 2 deletions

View file

@ -209,7 +209,7 @@ defmodule Philomena.Tags do
new_count = new_count =
Image Image
|> join(:inner, [i], _ in assoc(i, :tags)) |> join(:inner, [i], _ in assoc(i, :tags))
|> where([_i, t], t.id == ^target_tag.id) |> where([i, t], i.hidden_from_users == true and t.id == ^target_tag.id)
|> Repo.aggregate(:count, :id) |> Repo.aggregate(:count, :id)
Tag Tag

View file

@ -3,7 +3,6 @@ defmodule PhilomenaWeb.Tag.ImageController do
alias Philomena.Tags.Tag alias Philomena.Tags.Tag
alias Philomena.Tags alias Philomena.Tags
import Ecto.Query
plug PhilomenaWeb.CanaryMapPlug, update: :edit, delete: :edit plug PhilomenaWeb.CanaryMapPlug, update: :edit, delete: :edit
plug :load_and_authorize_resource, model: Tag, id_name: "tag_id", id_field: "slug", preload: [:implied_tags], persisted: true plug :load_and_authorize_resource, model: Tag, id_name: "tag_id", id_field: "slug", preload: [:implied_tags], persisted: true