 
 
   def factory(conn, _params) do
-    podcasts = Repo.all(from p in Podcast, order_by: [asc: :updated_at],
-                                           where: p.update_paused == true)
+    podcasts = from(p in Podcast, order_by: [asc: :updated_at],
+                                  where: p.update_paused == true)
+               |> Repo.all()
                |> Repo.preload([:feeds, :owner])
+
     render(conn, "factory.html", podcasts: podcasts)
   end
 


  def delta_import_all(conn, _params) do
    current_user = conn.assigns.current_user
    podcasts = Repo.all(from p in Podcast, where: p.updated_at <= ^ten_hours_ago and
                                                  (is_nil(p.update_paused) or p.update_paused == false),
                                           order_by: [asc: :updated_at])

    for podcast <- podcasts do
      notification = case Pan.Parser.Podcast.delta_import(podcast.id) do

  plug :scrub_params, "podcast" when action in [:create, :update]

  def orphans(conn, _params) do
    podcast_ids = from(a in "categories_podcasts", group_by: a.podcast_id,
                                                   select: a.podcast_id)
                  |> Repo.all

    podcasts = from(p in Podcast, where: not p.id in ^podcast_ids)
               |> Repo.all

    render(conn, "orphans.html", podcasts: podcasts)
  end
