Fix update feeds thinking all items already exist
Repo.exists? needs a query, not the keyword list
This commit is contained in:
parent
a02ec174be
commit
ddceb28803
|
@ -1,6 +1,7 @@
|
|||
defmodule Frenzy.Item do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
alias FrenzyWeb.Router.Helpers, as: Routes
|
||||
alias FrenzyWeb.Endpoint
|
||||
|
||||
|
@ -87,6 +88,6 @@ defmodule Frenzy.Item do
|
|||
end
|
||||
|
||||
def exists?(feed_id, guid) do
|
||||
Frenzy.Repo.exists?(__MODULE__, feed_id: feed_id, guid: guid)
|
||||
Frenzy.Repo.exists?(from i in __MODULE__, where: i.feed_id == ^feed_id and i.guid == ^guid)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -159,7 +159,6 @@ defmodule Frenzy.UpdateFeeds do
|
|||
end
|
||||
|
||||
Enum.each(rss.items, fn entry ->
|
||||
# todo: use Repo.exists for this
|
||||
unless Item.exists?(feed.id, entry.guid) do
|
||||
CreateItem.start_link(feed, entry)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue