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

Adding work to multiple single membership collections from new work form does not forward as expected #4010

Open
11 tasks
elrayle opened this issue Sep 17, 2019 · 1 comment
Assignees
Labels
Collection impacts the Collection part of PCDM Model Work impacts the Work part of PCDM Model
Milestone

Comments

@elrayle
Copy link
Contributor

elrayle commented Sep 17, 2019

Descriptive summary

This issue lays out expected forwarding behavior when adding a new work to multiple collections through the new work form fails.

NOTE: This likely uses the same behaviors when performing the same actions on the edit work form. This issue and issue #4011 are tightly related and the fix for one may fix both.

Rationale

Provide intuitive forwarding behavior that focuses on the actions a user will most likely want to take next. Provide error message that is easy to understand.

Expected behavior

When adding a work to multiple collections from the work new form...

FAILURE to add the work to the collections should:

  • stay on new form (Relationships tab)
  • no changes are saved
  • should maintain filled in metadata (Descriptions tab)
  • should maintain any files added for upload (Files tab)
  • show flash error (red): Collections Error: You have specified more than one collection of the same single-membership collection type (collection type: name of collection type, collections: list of effected collections). The work was not added to those collections.

Testing

Actual behavior

When adding a work to multiple collections from the work new form...

FAILURE to add the work to the collections should:

  • forwards to Descriptions tab on new form
  • no changes are saved
  • all metadata fields are cleared (Descriptions tab)
  • files for upload are no longer listed (Files tab)
  • shows flash error: Collections Error: You have specified more than one of the same single-membership collection type (type: name of collection type, collections: list of effected collections)

Steps to reproduce the behavior

Prerequisites:

Need a collection type that is set to allow single membership. If testing on Nurax, this collection type may already exist. Look for Collection Type Single Membership. If it doesn't exist, then create a single membership collection type using...

  • Dashboard -> Settings -> Collection Types -> Create new collection type
  • Assign type name Single Membership and Save
  • On Settings tab, uncheck MULTIPLE MEMBERSHIP and Save changes

Need two collections of type Single Membership. You can create using...

  • Dashboard -> Collections -> New Collection -> select Single Membership type -> Create Collection
  • Assign suitable titles for the two collections and save. This issue will refer to them as SM1 and SM2.

Test:

Verify FAILURE behaves as expected.

  1. Dashboard -> Works -> Add new work
  2. select type (if needed) -> Create work
  3. fill in required metadata on Descriptions tab
  4. add file from Files tab
  5. check box for Depositor Agreement (if required)
  6. on Relationships tab -> Collections -> Add to collection -> type SM1 -> Add
  7. on Relationships tab -> Collections -> Add to collection -> type SM2 -> Add
  8. click Save button
  • Verify stays in new form on Relationships tab.
  • Verify flash error (red) with message "Collections Error: You have specified more than one collection of the same single-membership collection type (collection type: Single Membership, collections: SM1, SM2). The work was not added to those collections."
  • Verify that metadata filled in on Descriptions tab is still filed in as expected.
  • Verify that any files added on the Files tab are still ready for upload.
  • Verify work was not created.

Related work

@blancoj
Copy link
Contributor

blancoj commented Jun 24, 2020

I looked at this issue and was not successful. Basically, when there is an error creating a work, this is called:
https://github.com/samvera/hyrax/blob/master/app/controllers/concerns/hyrax/works_controller_behavior.rb#L61

From there you go here: https://github.com/samvera/hyrax/blob/master/app/controllers/concerns/hyrax/works_controller_behavior.rb#L166

The first parameter being passed is curation_concern which will contain the work model (for example, GenericWork ) to use when building the form. When there is an error, the model contains no data. This happens because when an error is encountered while traversing the actor stack, the model is not built.

This is where the model would be completed had the work input by the user had no errors:
https://github.com/samvera/hyrax/blob/master/app/actors/hyrax/actors/base_actor.rb#L20

So the form is built without any of the user's previously input data. I tried to build the model containing the values in param, but was not successful. I could get the metadata in the model, but the rest of the user input, I could not.

@elrayle elrayle added the Work impacts the Work part of PCDM Model label Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Collection impacts the Collection part of PCDM Model Work impacts the Work part of PCDM Model
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants