diff --git a/lib/elixir_conf_africa_web/live/home_live/index.ex b/lib/elixir_conf_africa_web/live/home_live/index.ex index 63e1063..bae9372 100644 --- a/lib/elixir_conf_africa_web/live/home_live/index.ex +++ b/lib/elixir_conf_africa_web/live/home_live/index.ex @@ -29,12 +29,7 @@ defmodule ElixirConfAfricaWeb.HomeLive.Index do cart_item_ids = Cart.cart_list_ids(socket.assigns.cart) if Enum.member?(cart_item_ids, String.to_integer(id)) do - updated_cart = Cart.add_to_cart(socket.assigns.cart, String.to_integer(id)) - - {:noreply, - socket - |> assign(:cart, updated_cart) - |> put_flash(:info, "Ticket already in cart , quantity increased by 1")} + {:noreply, put_flash(socket, :error, "Ticket already in cart")} else updated_cart = Cart.add_to_cart(socket.assigns.cart, String.to_integer(id)) diff --git a/test/elixir_conf_africa_web/live/home_live_test.exs b/test/elixir_conf_africa_web/live/home_live_test.exs index 3a4a799..133a533 100644 --- a/test/elixir_conf_africa_web/live/home_live_test.exs +++ b/test/elixir_conf_africa_web/live/home_live_test.exs @@ -53,7 +53,7 @@ defmodule ElixirConfAfricaWeb.HomeLiveTest do assert index_live |> element("#ticket_type-#{ticket_type.id}") - |> render_click() =~ "Ticket already in cart , quantity increased by 1" + |> render_click() =~ "Ticket already in cart" end end end