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

Work in progress toward Transfer processing form #705

Merged
merged 3 commits into from
May 12, 2021

Conversation

matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented May 7, 2021

This adds the first part of the transfer processing form. Along the way it also changes the ability model to restrict who can see this path, and it restructures the controller tests for Transfer records.

This work addresses two tickets:
https://mitlibraries.atlassian.net/browse/ETD-277
https://mitlibraries.atlassian.net/browse/ETD-278

Special note: I'm not thrilled by the approach taken by the last test in the controller test file, but I don't see an alternative other than re-doing the fixtures (which feels like work that's going to spiral). If that's needed, I'll do it - but I wanted to make that decision via code review.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@matt-bernhardt matt-bernhardt marked this pull request as draft May 7, 2021 21:51
@mitlib mitlib temporarily deployed to thesis-submit-pr-705 May 7, 2021 21:52 Inactive
@coveralls
Copy link

coveralls commented May 7, 2021

Coverage Status

Coverage increased (+0.04%) to 94.574% when pulling dfacd66 on etd-277-transfer-processing-2 into c65b501 on main.

@matt-bernhardt matt-bernhardt temporarily deployed to thesis-submit-pr-705 May 10, 2021 14:41 Inactive
@matt-bernhardt matt-bernhardt force-pushed the etd-277-transfer-processing-2 branch from e2209fc to 30b1b0a Compare May 10, 2021 15:17
@matt-bernhardt matt-bernhardt temporarily deployed to thesis-submit-pr-705 May 10, 2021 15:17 Inactive
@matt-bernhardt matt-bernhardt temporarily deployed to thesis-submit-pr-705 May 10, 2021 16:17 Inactive
** Why are these changes being introduced:

* These two tickets (and the mockups which inspired them) call for a
  web form to facilitate selecting specific files in a given Transfer
  record. Each file will have a checkbox, allowing the processor to
  identify which should move next.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/ETD-277
* https://mitlibraries.atlassian.net/browse/ETD-278

** How does this address that need:

* This extends the show route on the Transfer controller, building a
  web form.
* The page shows overall information about the Transfer record (such as
  the submitter's name, department, and notes).
* The form lists all the attached Files by name, with a checkbox for
  each. This form does not use SimpleForm, just the basic Rails form
  helpers.
* There is a blank area next to the file list that will in future work
  be extended to provide a Thesis selection UI.
* There is a files method in the controller that receives this form's
  parameters. The method currently does no work, only defining a flash
  message with the selected file IDs. That method will be extended in
  future tickets.
* The file controller has one additional permitted parameter, for the
  list of file IDs.
* There are some form-specific styles added to the stylesheet.
* The transfer controller tests have been restructured; hopefully they
  are a bit clearer now.

** Document any side effects to this change:

* The form template is not quite what I expected it to be, but I think
  it is still acceptable in the Rails world. I hope.
* The test for the files method in the transfer controller is a bit
  kludgy, because our existing fixtures do not have file records. This
  probably needs to be fixed before this merges, but for now this test
  creates a new Transfer record which does have a file.
@matt-bernhardt matt-bernhardt force-pushed the etd-277-transfer-processing-2 branch from d551d08 to 1a64fec Compare May 10, 2021 17:49
@matt-bernhardt matt-bernhardt temporarily deployed to thesis-submit-pr-705 May 10, 2021 17:49 Inactive
@matt-bernhardt matt-bernhardt marked this pull request as ready for review May 10, 2021 17:59
@JPrevost JPrevost self-assigned this May 11, 2021
Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

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

No blocking comments, but a new series of tests should probably be added (a new backlog maintenance ticket is fine for that work).

:shipit:

filelist.each do |file|
flash[:success] += ("File ID: " + file.to_s + "<br>").html_safe
end
flash[:success] += "This has been a test of the files method. If this were an actual method, these " + filelist.count.to_s + " files would have been transferred."
Copy link
Member

Choose a reason for hiding this comment

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

I know this is placeholder text, but since we've been calling "Transfers" the process of a Department admin adding files to our system lets refer to moving files from those Transfers to Theses not "transferred" to avoid confusion. I think something like "attached to the selected thesis" might be clearer?

@@ -45,6 +45,7 @@
}

get 'transfer/confirm', to: 'transfer#confirm', as: 'transfer_confirm'
post 'transfer/files', to: 'transfer#files', as: 'transfer_files'
Copy link
Member

Choose a reason for hiding this comment

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

We discussed on slack possibly moving this to the Thesis controller as the action is on Theses and not Transfers (not blocking for this work, but wanted to note it here for future us). We'll likely address this in the following PRs as we haven't made a decision yet.

end

test 'basic user cannot submit or view a transfer' do
# ~~~~~~~~~~~~~~~~~~~~~~~~~~ new transfer form ~~~~~~~~~~~~~~~~~~~~~
Copy link
Member

Choose a reason for hiding this comment

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

This series of tests is named "can / cannot submit a transfer" but really is about accessing the transfer new form and doesn't test submitting. I think ideally we'd have a series of tests for the form and a series of tests for the POST itself.

An existing test test 'redirect after successful submission' could be the pattern for each user type (I think).

As we didn't have that before, it is technically out of scope for this work so maybe we can add a maintenance ticket?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at this comment and the tests, it would have been equivalent effort to create the ticket and just update the tests - so I'm about to push a commit that should address this directly. If it doesn't, I'll create the ticket.

@matt-bernhardt matt-bernhardt temporarily deployed to thesis-submit-pr-705 May 11, 2021 19:44 Inactive
@matt-bernhardt
Copy link
Member Author

I've pushed two new commits that address your first and third comments (the second required no action yet) - so if you get a chance and can look at those, let me know if they resolve your concerns?

@matt-bernhardt matt-bernhardt merged commit be47933 into main May 12, 2021
@matt-bernhardt matt-bernhardt deleted the etd-277-transfer-processing-2 branch May 12, 2021 21:13
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.

4 participants