Skip to content

Prevent self and duplicate references in Assets Used #660

@david-fong-bc

Description

@david-fong-bc

Describe the bug

When editing a Metadata Record's "Assets Used" field- a Metadata Record field which can point to other Metadata Records to indicate that one data asset uses another one(s)- currently,

(see screenshot below)

To reproduce

Steps to reproduce the behaviour:

  1. Go to a Metadata Record's edit page, like https://dev.cat.data.fin.gov.bc.ca/node/27/build
  2. Find the "Assets Used" field (currenlty under the "Section 3: Origin and classification" section)
  3. In an input box for a new "asset used" entry, type the name of the Metadata Record being edited and observe that it shows up and can be selected. Select it.
  4. Add two more "assets used", both referring to the same other Metadata Record. Observe that the action is allowed (despite duplicate "assets used" not being meaningful).
  5. Save the changes and observe that there are neither automatic removals of the self-reference or duplicate references, nor validation warnings.

Expected behaviour

I think it would be beneficial to user experience if we don't show self-references and duplicate references in the autocomplete UI that shows up once the user starts typing in the field.

On top of that, I think it would be beneficial to either

  1. Not show self-references and duplicate references in the autocomplete UI that shows up once the user starts typing in the field, and automatically remove self-references or duplicate references as an automatic pre-step of the change-saving process
  2. Or raise a validation warning/error if the user tries to save changes with a self-reference or duplicate reference.

(I think automatic removal is preferable in this case)

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtaska task that a dev team member needs to address

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions