uvalib/tracksys

"Couldn't find Unit without an ID" errors on :start_manual_upload_to_archive_production

sdm7g opened this issue · 1 comments

app/processors/send_unit_to_archive_processor.rb:126

non-tracksys managed data does not have a unit_id.
This line raises an error when unit_id is nil:

    Unit.find(@unit_id)

That code should probably be:

if @errors.eql?(0)
  # Try to log where this unit is archived
  archival_location="StorNext"
  unit = unit_id and Unit.find(@unit_id)
  if unit && unit.archive
    if unit.archive.respond_to?(:name)
      archival_location=unit.archive.name
    end
  end

Fixed in production-new branch. ( This and some earlier changes of Matt's need to be merged back into master as well. )

commit 4353bfa
Author: Steve Majewski sdm7g@virginia.edu
Date: Mon May 12 15:24:48 2014 -0400

Issue #180 -- https://github.com/uvalib-dcs/tracksys/issues/180
guard Unit.find for nil unit case