From 0363e5ddaa35db40f2ba6488cad367a688f2e580 Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Thu, 5 Oct 2023 11:22:04 -0400 Subject: [PATCH] Allow processors to reset publication error status Why are these changes being introduced: * There is no way in the application to reset a publication error status other than manually resaving each thesis that has errored. Until his point, we only had one or two errors per patch so this was not a huge problem. However, recently our vended DSpace ran out of disk space and rejected a batch of 40 theses. Rather than manually resetting each, we felt it was time to add the ability for processors to reset all errors to move them back to publication review. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/ETD-638 How does this address that need: * Creates a Thesis controller restricted to processors and above that changes all Theses with the error status to the review status * Displays a link to reset publication errors on the view that shows the list of errors Document any side effects to this change: --- app/controllers/thesis_controller.rb | 8 +++ app/models/ability.rb | 1 + app/views/thesis/select.html.erb | 19 ++++++ config/routes.rb | 2 + test/controllers/thesis_controller_test.rb | 77 ++++++++++++++++++++++ test/fixtures/authors.yml | 8 +++ test/fixtures/theses.yml | 14 ++++ test/models/report_test.rb | 10 +-- 8 files changed, 134 insertions(+), 5 deletions(-) diff --git a/app/controllers/thesis_controller.rb b/app/controllers/thesis_controller.rb index 3b3710ac..54ae61eb 100644 --- a/app/controllers/thesis_controller.rb +++ b/app/controllers/thesis_controller.rb @@ -154,6 +154,14 @@ def proquest_export redirect_to thesis_proquest_export_preview_path end + def reset_all_publication_errors + Thesis.where(publication_status: 'Publication error').update(publication_status: 'Not ready for publication') + + flash[:success] = 'Publication error statuses have been reset' + + redirect_to thesis_select_path + end + private # Various methods need to build an array of academic terms which meet varying conditions, in order to support a UI diff --git a/app/models/ability.rb b/app/models/ability.rb index 64689460..9260960e 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -85,6 +85,7 @@ def processor can :publish_to_dspace, Thesis can :proquest_export, Thesis can :proquest_export_preview, Thesis + can :reset_all_publication_errors, Thesis can :select, Thesis can :read, Transfer diff --git a/app/views/thesis/select.html.erb b/app/views/thesis/select.html.erb index d7c39ab6..3d9606ff 100644 --- a/app/views/thesis/select.html.erb +++ b/app/views/thesis/select.html.erb @@ -52,6 +52,18 @@ + +