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

prevent double linking of datasets and dataverses #7259 #7415

Merged
merged 6 commits into from Nov 20, 2020
Merged

Conversation

pdurbin
Copy link
Member

@pdurbin pdurbin commented Nov 16, 2020

What this PR does / why we need it:

Users have been able to link a dataset to the same dataverse twice (or more) via API. This prevents it.

Update: in testing, it was found that it's also possible to link a dataverse to the same dataverse more than once. A fix has been added for this too.

Which issue(s) this PR closes:

Closes #7259

Special notes for your reviewer:

I tacked a test on an existing test method but I'm happy to create a dedicated test method if that's preferred. Update: a new LinkIT test class was added.

Suggestions on how to test this:

  • Try to link the same dataset to the same dataverse via API multiple times.
  • Try to link the same dataverse to the same dataverse via API multiple times.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

No.

Is there a release notes update needed for this change?:

Probably not worth it. Just a bug fix.

Additional documentation:

None.

Copy link
Contributor

@scolapasta scolapasta left a comment

Choose a reason for hiding this comment

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

Added a few comments / questions. Also, do we know if the same issue exists for linking dataverses? if so, should we add similar logic to LinkDataverseCommand?

@coveralls
Copy link

coveralls commented Nov 16, 2020

Coverage Status

Coverage decreased (-0.001%) to 19.479% when pulling 403a966 on 7259-linking into 40cda0e on develop.

@pdurbin pdurbin self-assigned this Nov 19, 2020
@pdurbin pdurbin moved this from Review 🦁 to IQSS Team - In Progress 💻 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Nov 19, 2020
@pdurbin pdurbin changed the title prevent double linking of datasets #7259 prevent double linking of datasets and dataverses #7259 Nov 19, 2020
@pdurbin
Copy link
Member Author

pdurbin commented Nov 19, 2020

Also, do we know if the same issue exists for linking dataverses? if so, should we add similar logic to LinkDataverseCommand?

Yes, the same issue exists. Fixed in 5d4a3dc.

@pdurbin pdurbin moved this from IQSS Team - In Progress 💻 to Review 🦁 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Nov 19, 2020
@pdurbin pdurbin removed their assignment Nov 19, 2020
@pdurbin pdurbin moved this from Review 🦁 to IQSS Team - In Progress 💻 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Nov 19, 2020
@pdurbin pdurbin self-assigned this Nov 19, 2020
@pdurbin pdurbin moved this from IQSS Team - In Progress 💻 to Review 🦁 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Nov 19, 2020
@pdurbin pdurbin removed their assignment Nov 19, 2020
@pdurbin
Copy link
Member Author

pdurbin commented Nov 19, 2020

I'm going to go ahead and put this into code review even though I might add another test for #7430 (as discussed in Slack). Here are the changes since the last code review:

  • Tests have been moved to a dedicated class called LinkIT.
  • In fact the same problem happens with linking dataverses. Fixed and I updated the description of this pull request.
  • The potential performance problem noticed in the last review was fixed by switching to an "alreadyLinked" method.

@pdurbin
Copy link
Member Author

pdurbin commented Nov 20, 2020

I moved it back to in progress to reflect that I'm still hacking on tests.

@pdurbin
Copy link
Member Author

pdurbin commented Nov 20, 2020

In 403a966 I wrote some tests that demonstrate that #7430 is a real issue. Hopefully they will be a good starting point when we pick that issue up. I'm moving this back to code review.

@pdurbin pdurbin removed their assignment Nov 20, 2020
@pdurbin pdurbin moved this from IQSS Team - In Progress 💻 to Review 🦁 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Nov 20, 2020
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Review 🦁 to QA 🔎✅ Nov 20, 2020
@kcondon kcondon self-assigned this Nov 20, 2020
@kcondon kcondon merged commit f940279 into develop Nov 20, 2020
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA 🔎✅ to Done 🚀 Nov 20, 2020
@kcondon kcondon deleted the 7259-linking branch November 20, 2020 23:59
@djbrooke djbrooke added this to the 5.3 milestone Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Linking Dataset API called twice will create two rows in db
5 participants