Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: list_items query #357

Closed
3 tasks done
nelsonic opened this issue Apr 19, 2023 · 4 comments
Closed
3 tasks done

Feat: list_items query #357

nelsonic opened this issue Apr 19, 2023 · 4 comments
Assignees
Labels
elixir Pull requests that update Elixir code enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! priority-1 Highest priority issue. This is costing us money every minute that passes. T1h Time Estimate 1 Hour technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@nelsonic
Copy link
Member

nelsonic commented Apr 19, 2023

As outlined in #145 (comment) we need a way of querying the list_items table
which will have multiple entries for the same item to reflect re-ordering the items on a list.

Note: for now, the fact that full history of changes to lists 📜
is stored in the list_items table is not visible anywhere in the interface. 🙈
i.e. people using the App (MVP) have no idea they can "undo" changes. ◀️
Once we have a chance to work on the wireframes for this, we can publicise it. 📣

Todo

  • Create the SQL (or Ecto) query for returning the list of items.
    should:
    • GROUP BY item_id so that similar entries in the list_items table are ignored
    • ignore records in list_items where position=999999.999 as per EPIC: lists Schema + Setup #356
      which signifies that an item was removed from the list.

This should be enough to get this working. 💭

@nelsonic nelsonic added enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! technical A technical issue that requires understanding of the code, infrastructure or dependencies priority-1 Highest priority issue. This is costing us money every minute that passes. T1h Time Estimate 1 Hour elixir Pull requests that update Elixir code labels Apr 19, 2023
@nelsonic nelsonic self-assigned this Apr 19, 2023
@nelsonic
Copy link
Member Author

Will be working on this tomorrow morning.
image

@nelsonic
Copy link
Member Author

Side quest: #358

@nelsonic
Copy link
Member Author

nelsonic commented Aug 4, 2023

I wish this had been T1h .... but sadly, it wasn't. ⏳ 😢
It's what I'm looking at next though. 🧑‍💻
Because it's contained in the PR #345
And I really don't want to be refactoring it.

Once that's done, we can add the Hyperlink URLs feature #141
Which is already working in the Demo: https://amemo.fly.dev

@nelsonic
Copy link
Member Author

Simplified significantly by using cids. ✅

mvp/lib/app/item.ex

Lines 227 to 242 in a386f98

def items_with_timers(person_id \\ 0) do
all_list = App.List.get_all_list_for_person(person_id)
# dbg(all_list)
seq = App.ListItems.get_list_items(all_list.cid)
# dbg(seq)
sql = """
SELECT i.id, i.cid, i.text, i.status, i.person_id, i.updated_at,
t.start, t.stop, t.id as timer_id
FROM items i
FULL JOIN timers AS t ON t.item_id = i.id
WHERE i.cid = any($1)
AND i.status IS NOT NULL
AND i.text IS NOT NULL
ORDER BY timer_id ASC;
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elixir Pull requests that update Elixir code enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! priority-1 Highest priority issue. This is costing us money every minute that passes. T1h Time Estimate 1 Hour technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
Status: Done
Development

No branches or pull requests

1 participant