diff --git a/README.md b/README.md index c91bd528..0207a4fc 100644 --- a/README.md +++ b/README.md @@ -2239,7 +2239,7 @@ that creates in the user's mind. Let's fix it! -Open your `lib/app_web/views/item_view.ex` file +Open your `lib/app_web/controllers/item_html.ex` file and add the following function definition `unarchived_items/1`: ```elixir diff --git a/lib/app_web/controllers/item_html.ex b/lib/app_web/controllers/item_html.ex index 7738c9f6..89e591b5 100644 --- a/lib/app_web/controllers/item_html.ex +++ b/lib/app_web/controllers/item_html.ex @@ -33,4 +33,8 @@ defmodule AppWeb.ItemHTML do false -> "item" end end + + def got_items?(items) do + Enum.filter(items, fn i -> i.status < 2 end) |> Enum.count > 0 + end end diff --git a/lib/app_web/controllers/item_html/index.html.heex b/lib/app_web/controllers/item_html/index.html.heex index fa9427a1..b68bc569 100644 --- a/lib/app_web/controllers/item_html/index.html.heex +++ b/lib/app_web/controllers/item_html/index.html.heex @@ -55,54 +55,56 @@ <% end %> - + <% end %>