Skip to content
New issue

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

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

Already on GitHub? # to your account

Item_changes not capturing booleans #236

Open
tjchambers opened this issue Oct 16, 2024 · 0 comments
Open

Item_changes not capturing booleans #236

tjchambers opened this issue Oct 16, 2024 · 0 comments

Comments

@tjchambers
Copy link

tjchambers commented Oct 16, 2024

In my tests I can see that booleans are not captured in PaperTrail item_changes.

#Ecto.Changeset<
  action: nil,
  changes: %{informed?: false},
  errors: [],
  data: #Sct.Align.Participant<>,
  valid?: true,
  ...
>
07:59:36.372 request_id=F_725mQ5H4Xs9e0AADlO [debug] QUERY OK db=0.3ms idle=333.0ms
begin []
07:59:36.372 request_id=F_725mQ5H4Xs9e0AADlO [debug] QUERY OK source="participants" db=0.4ms
UPDATE "participants" SET "source" = $1, "i" = $2, "updated_at" = $3 WHERE "id" = $4 ["28-c4b53727-f1653e", false, ~U[2024-10-16 14:59:36.372083Z], 249538]
07:59:36.374 request_id=F_725mQ5H4Xs9e0AADlO [debug] QUERY OK source="versions" db=0.6ms
INSERT INTO "versions" ("event","item_changes","item_type","item_id","originator_id","inserted_at") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id" ["update", %{source: "28-c4b53727-f1653e"}, "Participant", 249538, 4, ~U[2024-10-16 14:59:36.373077Z]]
07:59:36.374 request_id=F_725mQ5H4Xs9e0AADlO [debug] QUERY OK db=0.7ms
commit []

in examining the tests in this repo the person_test.exs seems to also replicate that regarding the gender column:

  assert Map.drop(person, [:company]) == %{
      company_id: target_company.id,
      first_name: "Isaac",
      visit_count: 10,
      birthdate: ~D[1992-04-01], #  this is the only problem
      last_name: "Nakri",
      gender: true
    }

    assert Map.drop(version, [:id]) == %{
      event: "update",
      item_type: "Person",
      item_id: first_person.id,
      item_changes: %{
        first_name: "Isaac",
        visit_count: 10,
        birthdate: ~D[1992-04-01],
        company_id: target_company.id
      },
      origin: "user:1",
      originator_id: nil,
      meta: %{
        linkname: "izelnakri"
      }
    }
  end

is there a reason for not capturing those in item changes?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant