From 6afff866a213b051fefdc1cf8ae14de0ea24ca0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veikko=20Lintuj=C3=A4rvi?= Date: Tue, 16 Jan 2024 20:00:40 +0200 Subject: [PATCH] Early bird field to db --- lib/osuuspuutarha/orders/order.ex | 7 +- .../live/order_live/form_component.html.heex | 81 +++++----- .../live/order_live/index.ex | 2 +- .../live/order_live/index.html.heex | 74 +++++---- .../live/order_live/show.html.heex | 144 +++++++++--------- .../views/exports/order_view.ex | 1 + .../20240116170443_add_early_bird.exs | 9 ++ test/osuuspuutarha/orders_test.exs | 51 ++++++- .../live/order_live_test.exs | 48 +++++- test/support/fixtures/orders_fixtures.ex | 3 +- 10 files changed, 270 insertions(+), 150 deletions(-) create mode 100644 priv/repo/migrations/20240116170443_add_early_bird.exs diff --git a/lib/osuuspuutarha/orders/order.ex b/lib/osuuspuutarha/orders/order.ex index b5e567f..62a3921 100644 --- a/lib/osuuspuutarha/orders/order.ex +++ b/lib/osuuspuutarha/orders/order.ex @@ -39,6 +39,7 @@ defmodule Osuuspuutarha.Orders.Order do field :pcode, :string field :phone, :string field :split_invoice, :boolean, default: false + field :early_bird, :boolean, default: false timestamps() end @@ -58,7 +59,8 @@ defmodule Osuuspuutarha.Orders.Order do :email, :is_member, :split_invoice, - :even_weeks + :even_weeks, + :early_bird ]) |> validate_required([ :order_type, @@ -71,7 +73,8 @@ defmodule Osuuspuutarha.Orders.Order do :phone, :email, :is_member, - :split_invoice + :split_invoice, + :early_bird ]) end end diff --git a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex index 031f132..d77855b 100644 --- a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex @@ -8,89 +8,98 @@ phx-target={@myself} phx-change="validate" phx-submit="save"> - + <%= label f, :order_type, "Valitse tilausmuoto" %> - <%= select f, - :order_type, + <%= select f, + :order_type, [ - "Koko kausi": :full, + "Koko kausi": :full, "Koko kausi (pikkuboksi)": :full_pikku, - "Joka toinen viikko": :everyother, + "Joka toinen viikko": :everyother, "Joka toinen viikko (pikkuboksi)": :everyother_pikku, - "Elotilaus": :elo, + "Elotilaus": :elo, "Elotilaus (pikkuboksi)": :elo_pikku, "Viljely-yhteisö": :community, "Viljely-yhteisö (pikkuboksi)": :community_pikku - ], - prompt: "Ei valintaa" + ], + prompt: "Ei valintaa" %> - <%= if @action == :edit && @changeset.data.order_type == :everyother do %> + <%= error_tag f, :order_type %> + + <%= if @action == :edit && (@changeset.data.order_type == :everyother || @changeset.data.order_type == :everyother_pikku) do %>
<%= checkbox f, :even_weeks, class: "checkbox" %> <%= label f, :even_weeks, "Parilliset viikot" %> <%= error_tag f, :even_weeks %>
<% end %> - <%= error_tag f, :order_type %> - + + <%= if @action == :edit do %> +
+ <%= checkbox f, :early_bird, class: "checkbox" %> + <%= label f, :early_bird, "Early Bird" %> + <%= error_tag f, :early_bird %> +
+ <% end %> + <%= label f, :location, "Valitse jakopaikka" %> - <%= select f, - :location, + <%= select f, + :location, [ - "Koroinen, Koroistentie 2": "koroinen", - "Ocean Spirit, Linnankatu 37": "ocean", - "Raisio, Timonkuja 8": "raisio", - "Naantali, Alitalontie 20": "naantali", - "Viherlassila, Alakyläntie 2": "viherlassila", - "Kirjakahvila, Vanha Suurtori 3": "kirjakahvila", - "Askainen, Askaistentie 986": "askainen", + "Koroinen, Koroistentie 2": "koroinen", + "Ocean Spirit, Linnankatu 37": "ocean", + "Raisio, Timonkuja 8": "raisio", + "Naantali, Alitalontie 20": "naantali", + "Viherlassila, Alakyläntie 2": "viherlassila", + "Kirjakahvila, Vanha Suurtori 3": "kirjakahvila", + "Askainen, Askaistentie 986": "askainen", "Livonsaari, Pohjanpääntie 90": "livonsaari", "C/o Naantalin hunaja, Paltteentie 2, Merimasku": "merimasku" - ], - prompt: "Ei valintaa" + ], + prompt: "Ei valintaa" %> <%= error_tag f, :location %> - + <%= label f, :is_member, "Jäsenyytesi" %> - <%= select f, - :is_member, + <%= select f, + :is_member, [ - "Liity jäseneksi (kertamaksu 50€)": :false, - "Olen jo Livonsaaren Osuuspuutarhan jäsen": :true, + "Liity jäseneksi (kertamaksu 50€)": :false, + "Olen jo Livonsaaren Osuuspuutarhan jäsen": :true, ] %> <%= error_tag f, :is_member %> - +
<%= checkbox f, :split_invoice, class: "checkbox" %> <%= label f, :split_invoice, "Haluan maksaa laskun kahdessa erässä (sis. laskutuslisä 2,50€)" %> <%= error_tag f, :split_invoice %>
- + <%= label f, :fname, "Etunimi" %> <%= text_input f, :fname %> <%= error_tag f, :fname %> - + <%= label f, :lname, "Sukunimi" %> <%= text_input f, :lname %> <%= error_tag f, :lname %> - + <%= label f, :address, "Katuosoite" %> <%= text_input f, :address %> <%= error_tag f, :address %> - + <%= label f, :pcode, "Postinumero" %> <%= text_input f, :pcode %> <%= error_tag f, :pcode %> - + <%= label f, :city, "Postitoimipaikka" %> <%= text_input f, :city %> <%= error_tag f, :city %> - + <%= label f, :phone, "Puhelinnumero" %> <%= text_input f, :phone %> <%= error_tag f, :phone %> - + <%= label f, :email, "Sähköpostiosoite" %> <%= text_input f, :email %> <%= error_tag f, :email %> @@ -105,7 +114,7 @@ <% end %> - +
<%= submit @submit_text, phx_disable_with: "Tallennetaan..." %>
diff --git a/lib/osuuspuutarha_web/live/order_live/index.ex b/lib/osuuspuutarha_web/live/order_live/index.ex index 4f62585..bf5401b 100644 --- a/lib/osuuspuutarha_web/live/order_live/index.ex +++ b/lib/osuuspuutarha_web/live/order_live/index.ex @@ -6,7 +6,7 @@ defmodule OsuuspuutarhaWeb.OrderLive.Index do @impl true def mount(_params, _session, socket) do - {:ok, assign(socket, :orders, Orders.list_orders())} + {:ok, assign(socket, :orders, Orders.get_sorted_by(:desc, :inserted_at))} end @impl true diff --git a/lib/osuuspuutarha_web/live/order_live/index.html.heex b/lib/osuuspuutarha_web/live/order_live/index.html.heex index 8d7eeca..91f08f6 100644 --- a/lib/osuuspuutarha_web/live/order_live/index.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/index.html.heex @@ -21,80 +21,87 @@ - <%= cond do %> - <% @live_action == :sorted_desc && @column == :order_type -> %> <%= link "Tyyppi ↓", to: Routes.order_index_path(@socket, :sorted_asc, :order_type) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :order_type -> %> <%= link "Tyyppi ↓", to: Routes.order_index_path(@socket, :sorted_asc, :order_type) %> <% @live_action == :sorted_asc && @column == :order_type -> %> <%= link "Tyyppi ↑", to: Routes.order_index_path(@socket, :sorted_desc, :order_type) %> - <% true -> %> <%= link "Tyyppi", to: Routes.order_index_path(@socket, :sorted_asc, :order_type) %> + <% true -> %> <%= link "Tyyppi", to: Routes.order_index_path(@socket, :sorted_asc, :order_type) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :location -> %> <%= link "Paikka ↓", to: Routes.order_index_path(@socket, :sorted_asc, :location) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :location -> %> <%= link "Paikka ↓", to: Routes.order_index_path(@socket, :sorted_asc, :location) %> <% @live_action == :sorted_asc && @column == :location -> %> <%= link "Paikka ↑", to: Routes.order_index_path(@socket, :sorted_desc, :location) %> - <% true -> %> <%= link "Paikka", to: Routes.order_index_path(@socket, :sorted_asc, :location) %> + <% true -> %> <%= link "Paikka", to: Routes.order_index_path(@socket, :sorted_asc, :location) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :lname -> %> <%= link "Tilaaja ↓", to: Routes.order_index_path(@socket, :sorted_asc, :lname) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :lname -> %> <%= link "Tilaaja ↓", to: Routes.order_index_path(@socket, :sorted_asc, :lname) %> <% @live_action == :sorted_asc && @column == :lname -> %> <%= link "Tilaaja ↑", to: Routes.order_index_path(@socket, :sorted_desc, :lname) %> - <% true -> %> <%= link "Tilaaja", to: Routes.order_index_path(@socket, :sorted_asc, :lname) %> + <% true -> %> <%= link "Tilaaja", to: Routes.order_index_path(@socket, :sorted_asc, :lname) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :city -> %> <%= link "Osoite ↓", to: Routes.order_index_path(@socket, :sorted_asc, :city) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :city -> %> <%= link "Osoite ↓", to: Routes.order_index_path(@socket, :sorted_asc, :city) %> <% @live_action == :sorted_asc && @column == :city -> %> <%= link "Osoite ↑", to: Routes.order_index_path(@socket, :sorted_desc, :city) %> - <% true -> %> <%= link "Osoite", to: Routes.order_index_path(@socket, :sorted_asc, :city) %> + <% true -> %> <%= link "Osoite", to: Routes.order_index_path(@socket, :sorted_asc, :city) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :phone -> %> <%= link "Puh. ↓", to: Routes.order_index_path(@socket, :sorted_asc, :phone) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :phone -> %> <%= link "Puh. ↓", to: Routes.order_index_path(@socket, :sorted_asc, :phone) %> <% @live_action == :sorted_asc && @column == :phone -> %> <%= link "Puh. ↑", to: Routes.order_index_path(@socket, :sorted_desc, :phone) %> - <% true -> %> <%= link "Puh.", to: Routes.order_index_path(@socket, :sorted_asc, :phone) %> + <% true -> %> <%= link "Puh.", to: Routes.order_index_path(@socket, :sorted_asc, :phone) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :email -> %> <%= link "Säpö ↓", to: Routes.order_index_path(@socket, :sorted_asc, :email) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :email -> %> <%= link "Säpö ↓", to: Routes.order_index_path(@socket, :sorted_asc, :email) %> <% @live_action == :sorted_asc && @column == :email -> %> <%= link "Säpö ↑", to: Routes.order_index_path(@socket, :sorted_desc, :email) %> - <% true -> %> <%= link "Säpö", to: Routes.order_index_path(@socket, :sorted_asc, :email) %> + <% true -> %> <%= link "Säpö", to: Routes.order_index_path(@socket, :sorted_asc, :email) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :is_member -> %> <%= link "Jäsen? ↓", to: Routes.order_index_path(@socket, :sorted_asc, :is_member) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :is_member -> %> <%= link "Jäsen? ↓", to: Routes.order_index_path(@socket, :sorted_asc, :is_member) %> <% @live_action == :sorted_asc && @column == :is_member -> %> <%= link "Jäsen? ↑", to: Routes.order_index_path(@socket, :sorted_desc, :is_member) %> - <% true -> %> <%= link "Jäsen?", to: Routes.order_index_path(@socket, :sorted_asc, :is_member) %> + <% true -> %> <%= link "Jäsen?", to: Routes.order_index_path(@socket, :sorted_asc, :is_member) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :split_invoice -> %> <%= link "Kaksi laskua? ↓", to: Routes.order_index_path(@socket, :sorted_asc, :split_invoice) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :split_invoice -> %> <%= link "Kaksi laskua? ↓", to: Routes.order_index_path(@socket, :sorted_asc, :split_invoice) %> <% @live_action == :sorted_asc && @column == :split_invoice -> %> <%= link "Kaksi laskua? ↑", to: Routes.order_index_path(@socket, :sorted_desc, :split_invoice) %> - <% true -> %> <%= link "Kaksi laskua?", to: Routes.order_index_path(@socket, :sorted_asc, :split_invoice) %> + <% true -> %> <%= link "Kaksi laskua?", to: Routes.order_index_path(@socket, :sorted_asc, :split_invoice) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :even_weeks -> %> <%= link "Parilliset viikot ↓", to: Routes.order_index_path(@socket, :sorted_asc, :even_weeks) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :even_weeks -> %> <%= link "Parilliset viikot ↓", to: Routes.order_index_path(@socket, :sorted_asc, :even_weeks) %> <% @live_action == :sorted_asc && @column == :even_weeks -> %> <%= link "Parilliset viikot ↑", to: Routes.order_index_path(@socket, :sorted_desc, :even_weeks) %> - <% true -> %> <%= link "Parilliset viikot", to: Routes.order_index_path(@socket, :sorted_asc, :even_weeks) %> + <% true -> %> <%= link "Parilliset viikot", to: Routes.order_index_path(@socket, :sorted_asc, :even_weeks) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :inserted_at -> %> <%= link "Lisätty ↓", to: Routes.order_index_path(@socket, :sorted_asc, :inserted_at) %> + <%= cond do %> + <% @live_action==:sorted_desc && @column==:early_bird -> %> <%= link "Early Bird? ↓" , to: Routes.order_index_path(@socket, :sorted_asc, :early_bird) %> + <% @live_action==:sorted_asc && @column==:early_bird -> %> <%= link "Early Bird? ↑" , to: Routes.order_index_path(@socket, :sorted_desc, :early_bird) %> + <% true -> %> <%= link "Early Bird?" , to: Routes.order_index_path(@socket, :sorted_asc, :early_bird) %> + <% end %> + + + <%= cond do %> + <% @live_action == :sorted_desc && @column == :inserted_at -> %> <%= link "Lisätty ↓", to: Routes.order_index_path(@socket, :sorted_asc, :inserted_at) %> <% @live_action == :sorted_asc && @column == :inserted_at -> %> <%= link "Lisätty ↑", to: Routes.order_index_path(@socket, :sorted_desc, :inserted_at) %> - <% true -> %> <%= link "Lisätty", to: Routes.order_index_path(@socket, :sorted_asc, :inserted_at) %> + <% true -> %> <%= link "Lisätty", to: Routes.order_index_path(@socket, :sorted_asc, :inserted_at) %> <% end %> - <%= cond do %> - <% @live_action == :sorted_desc && @column == :updated_at -> %> <%= link "Viimeisin muutos ↓", to: Routes.order_index_path(@socket, :sorted_asc, :updated_at) %> + <%= cond do %> + <% @live_action == :sorted_desc && @column == :updated_at -> %> <%= link "Viimeisin muutos ↓", to: Routes.order_index_path(@socket, :sorted_asc, :updated_at) %> <% @live_action == :sorted_asc && @column == :updated_at -> %> <%= link "Viimeisin muutos ↑", to: Routes.order_index_path(@socket, :sorted_desc, :updated_at) %> - <% true -> %> <%= link "Viimeisin muutos", to: Routes.order_index_path(@socket, :sorted_asc, :updated_at) %> + <% true -> %> <%= link "Viimeisin muutos", to: Routes.order_index_path(@socket, :sorted_asc, :updated_at) %> <% end %> @@ -113,6 +120,7 @@ <%= Osuuspuutarha.Orders.Parser.parse_boolean(order.is_member) %> <%= Osuuspuutarha.Orders.Parser.parse_boolean(order.split_invoice) %> <%= Osuuspuutarha.Orders.Parser.parse_boolean(order.even_weeks) %> + <%= Osuuspuutarha.Orders.Parser.parse_boolean(order.early_bird) %> <%= Osuuspuutarha.Orders.Parser.parse_date(order.inserted_at) %> <%= Osuuspuutarha.Orders.Parser.parse_date(order.updated_at) %> diff --git a/lib/osuuspuutarha_web/live/order_live/show.html.heex b/lib/osuuspuutarha_web/live/order_live/show.html.heex index 7f74cc7..737ce5c 100644 --- a/lib/osuuspuutarha_web/live/order_live/show.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/show.html.heex @@ -2,92 +2,94 @@ <%= if @live_action in [:edit] do %> <.modal return_to={Routes.order_show_path(@socket, :show, @order)}> - <.live_component - module={OsuuspuutarhaWeb.OrderLive.FormComponent} - id={@order.id} - title={@page_title} - action={@live_action} - submit_text="Tallenna" - has_privacy_consent={false} - order={@order} - return_to={Routes.order_show_path(@socket, :show, @order)} - /> + <.live_component module={OsuuspuutarhaWeb.OrderLive.FormComponent} id={@order.id} title={@page_title} + action={@live_action} submit_text="Tallenna" has_privacy_consent={false} order={@order} + return_to={Routes.order_show_path(@socket, :show, @order)} /> -<% end %> + <% end %> - + + + <%= live_patch "Muokkaa" , to: Routes.order_show_path(@socket, :edit, @order), class: "button" %> + | + + <%= live_redirect "Takaisin" , to: Routes.order_index_path(@socket, :index) %> + \ No newline at end of file diff --git a/lib/osuuspuutarha_web/views/exports/order_view.ex b/lib/osuuspuutarha_web/views/exports/order_view.ex index f3f2a23..afe15ce 100644 --- a/lib/osuuspuutarha_web/views/exports/order_view.ex +++ b/lib/osuuspuutarha_web/views/exports/order_view.ex @@ -47,6 +47,7 @@ defmodule OsuuspuutarhaWeb.Exports.OrderView do Parser.parse_location(order.location), Parser.parse_boolean(order.even_weeks), Parser.parse_boolean(order.split_invoice), + Parser.parse_boolean(order.early_bird), Parser.parse_date(order.inserted_at), Parser.parse_date(order.updated_at) ] diff --git a/priv/repo/migrations/20240116170443_add_early_bird.exs b/priv/repo/migrations/20240116170443_add_early_bird.exs new file mode 100644 index 0000000..a3ef00c --- /dev/null +++ b/priv/repo/migrations/20240116170443_add_early_bird.exs @@ -0,0 +1,9 @@ +defmodule Osuuspuutarha.Repo.Migrations.AddEarlyBird do + use Ecto.Migration + + def change do + alter table(:orders) do + add :early_bird, :boolean, default: false, null: false + end + end +end diff --git a/test/osuuspuutarha/orders_test.exs b/test/osuuspuutarha/orders_test.exs index 29b3784..6f9d198 100644 --- a/test/osuuspuutarha/orders_test.exs +++ b/test/osuuspuutarha/orders_test.exs @@ -8,7 +8,21 @@ defmodule Osuuspuutarha.OrdersTest do import Osuuspuutarha.OrdersFixtures - @invalid_attrs %{address: nil, city: nil, email: nil, even_weeks: nil, fname: nil, is_member: nil, lname: nil, location: nil, order_type: nil, pcode: nil, phone: nil, split_invoice: nil} + @invalid_attrs %{ + address: nil, + city: nil, + email: nil, + even_weeks: nil, + fname: nil, + is_member: nil, + lname: nil, + location: nil, + order_type: nil, + pcode: nil, + phone: nil, + split_invoice: nil, + early_bird: nil + } test "list_orders/0 returns all orders" do order = order_fixture() @@ -21,7 +35,21 @@ defmodule Osuuspuutarha.OrdersTest do end test "create_order/1 with valid data creates a order" do - valid_attrs = %{address: "some address", city: "some city", email: "some email", even_weeks: true, fname: "some fname", is_member: true, lname: "some lname", location: :koroinen, order_type: :full, pcode: "some pcode", phone: "some phone", split_invoice: true} + valid_attrs = %{ + address: "some address", + city: "some city", + email: "some email", + even_weeks: true, + fname: "some fname", + is_member: true, + lname: "some lname", + location: :koroinen, + order_type: :full, + pcode: "some pcode", + phone: "some phone", + split_invoice: true, + early_bird: true + } assert {:ok, %Order{} = order} = Orders.create_order(valid_attrs) assert order.address == "some address" @@ -36,6 +64,7 @@ defmodule Osuuspuutarha.OrdersTest do assert order.pcode == "some pcode" assert order.phone == "some phone" assert order.split_invoice == true + assert order.early_bird == true end test "create_order/1 with invalid data returns error changeset" do @@ -44,7 +73,22 @@ defmodule Osuuspuutarha.OrdersTest do test "update_order/2 with valid data updates the order" do order = order_fixture() - update_attrs = %{address: "some updated address", city: "some updated city", email: "some updated email", even_weeks: false, fname: "some updated fname", is_member: false, lname: "some updated lname", location: :ocean, order_type: :everyother, pcode: "some updated pcode", phone: "some updated phone", split_invoice: false} + + update_attrs = %{ + address: "some updated address", + city: "some updated city", + email: "some updated email", + even_weeks: false, + fname: "some updated fname", + is_member: false, + lname: "some updated lname", + location: :ocean, + order_type: :everyother, + pcode: "some updated pcode", + phone: "some updated phone", + split_invoice: false, + early_bird: false + } assert {:ok, %Order{} = order} = Orders.update_order(order, update_attrs) assert order.address == "some updated address" @@ -59,6 +103,7 @@ defmodule Osuuspuutarha.OrdersTest do assert order.pcode == "some updated pcode" assert order.phone == "some updated phone" assert order.split_invoice == false + assert order.early_bird == false end test "update_order/2 with invalid data returns error changeset" do diff --git a/test/osuuspuutarha_web/live/order_live_test.exs b/test/osuuspuutarha_web/live/order_live_test.exs index fea32ba..ed6a0c1 100644 --- a/test/osuuspuutarha_web/live/order_live_test.exs +++ b/test/osuuspuutarha_web/live/order_live_test.exs @@ -4,9 +4,51 @@ defmodule OsuuspuutarhaWeb.OrderLiveTest do import Phoenix.LiveViewTest import Osuuspuutarha.OrdersFixtures - @create_attrs %{address: "some address", city: "some city", email: "some email", even_weeks: true, fname: "some fname", is_member: true, lname: "some lname", location: :koroinen, order_type: :full, pcode: "some pcode", phone: "some phone", split_invoice: true} - @update_attrs %{address: "some updated address", city: "some updated city", email: "some updated email", even_weeks: false, fname: "some updated fname", is_member: false, lname: "some updated lname", location: :ocean, order_type: :everyother, pcode: "some updated pcode", phone: "some updated phone", split_invoice: false} - @invalid_attrs %{address: nil, city: nil, email: nil, even_weeks: false, fname: nil, is_member: false, lname: nil, location: nil, order_type: nil, pcode: nil, phone: nil, split_invoice: false} + @create_attrs %{ + address: "some address", + city: "some city", + email: "some email", + even_weeks: true, + fname: "some fname", + is_member: true, + lname: "some lname", + location: :koroinen, + order_type: :full, + pcode: "some pcode", + phone: "some phone", + split_invoice: true, + early_bird: true + } + @update_attrs %{ + address: "some updated address", + city: "some updated city", + email: "some updated email", + even_weeks: false, + fname: "some updated fname", + is_member: false, + lname: "some updated lname", + location: :ocean, + order_type: :everyother, + pcode: "some updated pcode", + phone: "some updated phone", + split_invoice: false, + early_bird: false + } + @invalid_attrs %{ + address: nil, + city: nil, + email: nil, + even_weeks: false, + fname: nil, + is_member: false, + lname: nil, + location: nil, + order_type: nil, + pcode: nil, + phone: nil, + split_invoice: false, + early_bird: false + } defp create_order(_) do order = order_fixture() diff --git a/test/support/fixtures/orders_fixtures.ex b/test/support/fixtures/orders_fixtures.ex index ef4ec4b..14abf29 100644 --- a/test/support/fixtures/orders_fixtures.ex +++ b/test/support/fixtures/orders_fixtures.ex @@ -22,7 +22,8 @@ defmodule Osuuspuutarha.OrdersFixtures do order_type: :full, pcode: "some pcode", phone: "some phone", - split_invoice: true + split_invoice: true, + early_bird: true }) |> Osuuspuutarha.Orders.create_order()