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

Issue #435: deleting wrong option in heuristic test #441

Conversation

sajontahsen
Copy link
Contributor

@sajontahsen sajontahsen commented Apr 17, 2024

Description

This PR fixes #435

What's Causing the Bug

The bug seems to happen exclusively for options with no value set, as discussed here. To figure out why, first let's take a closer look at the deleteItem method:

deleteItem(item) {
  this.options.splice(this.options.indexOf(item), 1)
}

Now, my understanding is that if there are multiple items with values as null, indexOf might always return the index of the first item with null value, not necessarily the one we want to delete.

Measures

One way to fix this issue is to assign a unique identifier to each item when it is created, and use this identifier to find the correct item to delete. This ensures that even items with identical visible properties can be correctly distinguished. For this, I have attached a timestamp property to the items.

Working Demo

ruxailab-bugfix-435-2024_04_17.mp4

Copy link

sonarcloud bot commented Apr 17, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@KarinePistili
Copy link
Member

@FernandaCasali can you review it please?

@KarinePistili KarinePistili added the Review Check or stud something label Apr 17, 2024
Copy link
Member

@FernandaCasali FernandaCasali left a comment

Choose a reason for hiding this comment

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

Congratulations! 🎉 Your pull request has been accepted! Thank you for your valuable contribution.

Your changes have been merged successfully and will be included in the develop branch. Your effort in improving our project is greatly appreciated.

Thanks again for your contribution, and we look forward to your continued involvement in our project!

Best regards,
@FernandaCasali

@jvJUCA jvJUCA merged commit 76758e6 into ruxailab:develop Apr 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review Check or stud something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐞 BUG]: deleting wrong option in heuristic test
4 participants