- cond do
- is_binary(favicon) && existing_record ->
- existing_record
- |> changeset(%{favicon: favicon, favicon_updated_at: now})
- |> Repo.update()
-
- favicon
-
- is_binary(favicon) ->
- %Instance{}
- |> changeset(%{host: host, favicon: favicon, favicon_updated_at: now})
- |> Repo.insert()
-
- favicon
-
- true ->
- nil
+ if existing_record do
+ existing_record
+ |> changeset(%{favicon: favicon, favicon_updated_at: now})
+ |> Repo.update()
+ else
+ %Instance{}
+ |> changeset(%{host: host, favicon: favicon, favicon_updated_at: now})
+ |> Repo.insert()