mojotech / mojotech/torch

UUID filter_view/3 with filter_string_input/3 not working

Open
#554 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Elixir
Stars
1.2k
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Big thanks to @kevinam99 for adding UUID support in #521.
However when using filter_uuid/3 in combination with filter_string_input/3 it still defaults to :contains instead of :equals

Image Image

This is because, params = %{} when filter view is rendered the first time, so it defaults to :contains.

Introducing a new function in filter_view.ex that explicitly sets comparison to :equals, solves the issue. This would be a simple solution but I get the feeling it's just half the story.

  def filter_uuid_input(prefix, field, params) do
    prefix_str = to_string(prefix)
    {name, value} = find_param(params[prefix_str], field, :equals)
    text_input(prefix, String.to_atom(name), value: value)
  end```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in filter_view.ex and trace how filter_uuid/3 and filter_string_input/3 call find_param when params is empty. Confirm where the comparison defaults to :contains, then verify that UUID filters consistently use :equals without changing other filter behavior. The issue does not name a test file, so locate the existing filter view tests and add coverage for the combined case.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.