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

8600 duplicate template #8706

Merged
merged 17 commits into from
May 19, 2022
Merged

8600 duplicate template #8706

merged 17 commits into from
May 19, 2022

Conversation

sekmiller
Copy link
Contributor

@sekmiller sekmiller commented May 17, 2022

What this PR does / why we need it: Fixes logic in Copy template that was allowing templates with no dataverse ID to be created. Also adds admin APIs for finding and deleting templates and adds a script for deleting the orphan templates.

Which issue(s) this PR closes:

Closes #8600 Duplicate template seems to create db entries even when cancel.

Special notes for your reviewer: the fix in the cloneTemplate method was fairly simple. Handling the orphan templates added most of the changes

Suggestions on how to test this: the orphan templates are on the template table with Dataverse_id = null

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?: added

Additional documentation:

@scolapasta scolapasta self-assigned this May 17, 2022
@@ -46,6 +46,22 @@ public Template findByDeafultTemplateOwnerId(Long ownerId) {
query.setParameter("ownerId", ownerId);
return query.getSingleResult();
}

public List<Template> findByOwnerId(Long ownerId) {
TypedQuery<Template> query = em.createQuery("select object(o) from Template as o where o.dataverse.id =:ownerId order by o.name", Template.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make these named queries?

return query.getResultList();
}

public List<Template> findOrphan() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be removed, as with the other code?


https://github.com/IQSS/dataverse/raw/develop/scripts/issues/8600/delete_orphan_templates_8600.sh

In order to support the script two admin APIs for finding and deleting templates have been added.
Copy link
Contributor

Choose a reason for hiding this comment

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

just one, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

badly worded ("two" as in one for finding and one for deleting)

@coveralls
Copy link

coveralls commented May 19, 2022

Coverage Status

Coverage decreased (-0.01%) to 19.242% when pulling a9861fb on 8600-duplicate-template into 013fcd8 on develop.

@kcondon kcondon self-assigned this May 19, 2022
@kcondon kcondon merged commit fdef1f6 into develop May 19, 2022
@kcondon kcondon deleted the 8600-duplicate-template branch May 19, 2022 20:44
@pdurbin pdurbin added this to the 5.11 milestone Jun 2, 2022
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.

Duplicate template seems to create db entries even when cancel
5 participants