Skip to content

Bug: multiple correct rows in has_many fails condition #13

@mennolpFoF

Description

@mennolpFoF

Using permit ecto to recursively check multiple rows always returns false.
Looks like it does not properly loop through the enum as it should be and only able to check when the count of the enum is at 1.

permit()
    |> update(Project, project_coordinators: [coordinator_id: coordinator_id])
    |> read(Project, project_coordinators: [coordinator_id: coordinator_id])
    |> delete(Project, project_coordinators: [coordinator_id: coordinator_id])

Returns true when coordinator_id is 1

%Project{
  id: 1,
  project_coordinators: [
    %Coordinator{
      id: 1,
      coordinator_id: 1,
      project_id: 1
    }
  ]
}

returns false on both coordinator_id 1 and 2

%Project{
  id: 1,
  project_coordinators: [
    %Coordinator{
      id: 1,
      coordinator_id: 1,
      project_id: 1
    },
    %Coordinator{
      id: 2,
      coordinator_id: 2,
      project_id: 1
    }
  ]
}

Mix deps

{:phoenix, "~> 1.7.14"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.10"},
{:ecto, "~> 3.11.2"},
{:permit, "~> 0.2.0"},
{:permit_ecto, "~> 0.2"},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions