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

Fix(T33788): display only unique fields in the error message #634

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

sakutademos
Copy link
Contributor

Ticket: https://yaits.demos-deutschland.de/T33137 --> 1.PLZ wird 2x angezeigt (nur beim Feld PLZ tritt der Fehler auf

Description: This PR fixes the issue with incorrect field names in the error message: [object Set]
image

JavaScript Set was used for storing a collection of unique fields. However it does not work correctly after installing a new version of demosplan-ui in demosplan core..

  • use filter() function to display only unique fields

…ue fields. However it does not work correctly with demosplan core, use filter() function instead
src/mixins/dpValidateMixin.js Outdated Show resolved Hide resolved
const nonEmptyFieldNames = validatedForm.invalidFields
.map(field => field.getAttribute('data-dp-validate-error-fieldname'))
.filter(Boolean)
const nonEmptyUniqueFieldNames = nonEmptyFieldNames.filter((field, idx) => nonEmptyFieldNames.indexOf(field) === idx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, done here 8847423

Comment on lines 50 to 53
const nonEmptyFieldNames = validatedForm.invalidFields
.map(field => field.getAttribute('data-dp-validate-error-fieldname'))
.filter(Boolean)
const nonEmptyUniqueFieldNames = nonEmptyFieldNames.filter((field, idx) => nonEmptyFieldNames.indexOf(field) === idx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can extract that to an own small method since the exact same Code is used twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like. Although I wonder why sonarcloud is not complaining...

sakutademos and others added 2 commits November 9, 2023 14:12
Co-authored-by: salisdemos <40487461+salisdemos@users.noreply.github.com>
@sakutademos sakutademos merged commit 67a604b into main Nov 9, 2023
2 checks passed
@sakutademos sakutademos deleted the b_T33137_accessible_notifications_new_set_issue branch November 9, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants