Skip to content

Commit

Permalink
remove remaining dbg code #145
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Sep 7, 2023
1 parent a7408a1 commit 630255e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
14 changes: 1 addition & 13 deletions lib/app/item.ex
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,6 @@ defmodule App.Item do
|> Repo.update()
end

# defp reorder_list_to_add_item(%Item{position: position}) do
# # Increments the positions above a given position.
# # We are making space for the item to be added.

# from(i in Item,
# where: i.position > ^position,
# update: [inc: [position: 1]]
# )
# |> Repo.update_all([])
# end

def all_items_for_person(person_id) do
Item
|> where(person_id: ^person_id)
Expand All @@ -226,9 +215,8 @@ defmodule App.Item do
#
def items_with_timers(person_id \\ 0) do
all_list = App.List.get_all_list_for_person(person_id)
# dbg(all_list)
seq = App.List.get_list_seq(all_list)
# dbg(seq)


sql = """
SELECT i.id, i.cid, i.text, i.status, i.person_id, i.updated_at,
Expand Down
6 changes: 0 additions & 6 deletions lib/app/list.ex
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ defmodule App.List do
def get_all_list_for_person(person_id) do
# IO.inspect("get_all_list_for_person(person_id: #{person_id})")
all_list = get_list_by_name!("all", person_id)
# dbg(all_list)
if all_list == nil do
# doesn't exist, create it:
{:ok, %{model: list}} =
Expand All @@ -148,10 +147,8 @@ defmodule App.List do

def add_item_to_list(item_cid, list_cid, person_id) do
list = get_list_by_cid!(list_cid)
# dbg(list)
prev_seq = get_list_seq(list)
seq = [item_cid | prev_seq] |> Enum.join(",")
# dbg(seq)
update_list(list, %{seq: seq, person_id: person_id})
end

Expand Down Expand Up @@ -194,11 +191,8 @@ defmodule App.List do
"""
def add_all_items_to_all_list_for_person_id(person_id) do
all_list = App.List.get_all_list_for_person(person_id)
# dbg(all_list)
all_items = App.Item.all_items_for_person(person_id)
# dbg(all_items)
prev_seq = get_list_seq(all_list)
# dbg(prev_seq)
# Add add each `item.id` to the sequence of item ids:
seq =
Enum.reduce(all_items, prev_seq, fn i, acc ->
Expand Down
4 changes: 0 additions & 4 deletions lib/app_web/live/app_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ defmodule AppWeb.AppLive do
},
socket
) do
# IO.puts("285: current_item_id: #{current_item_id}, selected_item_id: #{selected_item_id} | #{Useful.typeof(selected_item_id)}")
AppWeb.Endpoint.broadcast(
@topic,
"move_items",
Expand Down Expand Up @@ -319,9 +318,6 @@ defmodule AppWeb.AppLive do
},
socket
) do
# IO.puts(
# "cur_item_id: #{current_item_id}, selected_item_id: #{selected_item_id}"
# )

{:noreply,
push_event(socket, "dragover-item", %{
Expand Down

0 comments on commit 630255e

Please sign in to comment.