Closed gaurijo closed 12 months ago
Thanks for the suggestions! I made the requested changes, but restored the check button for the IA check. I'd like to keep the IA check changes in a separate PR for my own record keeping. I'll push that up after this one is merged.
This PR includes:
hathitrust check
right after import is done, removing the need to manually click the hathitrust 'check' buttonFor in-depth explanation of how this was tested in
local/development environment
, please see my comment hereSummary of changes:
inside the
import_async(task)
method inapp/models/record_source.rb
, instantiates a newhathitrust object
, which then has the task passed through the hathitrust object'scheck_async()
methodrequires path to
Hathitrust model
inside theTask model
inside
Task model
, includes a new callback (after_save
) that first checks if the import is completed before triggering the hathitrust checkinside
Task model
, adds two new methods:import_task_completed?
which includes logic for checking thestatus
andservice
of the task. If the environment is inprod/demo
, the status it looks for isSUCCEEDED
. The service it looks for isLOCAL STORAGE
.triggers_hathitrust_check(task)
, which instantiates a newhathitrust object
, creates a new task (with service equal toHathitrust
and service equal toSUBMITTED
), and passes that newly created task inside thecheck_async()
method. Inprod/demo
this should trigger the hathitrust check process; in development, some tweaking will be required, such as calling on thecheck()
method and commenting out theBook.analyze_table
method inside theHathitrust
model.This tweak should ONLY be done to see how this works in development, and should not be in the production code.
inside
app/views/tasks/_tasks.html.haml
, the button to run the Hathitrust check is removed completely, and the alert notice at the top points to this change:test/models/task_test.rb
, which looks at how a Task object is created upon default, and how the new methods affect those attributes. All tests pass, and existing tests don't break with the new changes: