Problem when a top_container that belongs to another repo is linked to
bobbi-SMR opened this issue · 3 comments
Baker library (repo 11) tried to add items from a spreadsheet (attached), defining a top container. the code found a top container with the same name, but belonging to a different repository, and tried to associate the items with it, resulting in the following (badly defined) error:
ERROR: Unknown response: {"error":"ASSERTION FAILED: {:id=>74473, :repo_id=>4, :lock_version=>2, :json_schema_version=>1, :barcode=>nil, :ils_holding_id=>nil, :ils_item_id=>nil, :exported_to_ils=>nil, :indicator=>\"4\", :created_by=>\"huabowers\", :last_modified_by=>\"huabowers\", :create_time=>2017-07-14 16:21:31 UTC, :system_mtime=>2017-07-14 17:34:22 UTC, :user_mtime=>2017-07-14 16:21:31 UTC, :type_id=>23372} has a repo_id of 4 but the active repository is 11"} (code: 500)
(Where id 74473 turns out to be a top container belonging to repo 4):
mysql> select * from top_container where id = '74473'; +-------+---------+--------------+---------------------+---------+----------------+-------------+-----------------+-----------+------------+------------------+---------------------+---------------------+---------------------+---------+ | id | repo_id | lock_version | json_schema_version | barcode | ils_holding_id | ils_item_id | exported_to_ils | indicator | created_by | last_modified_by | create_time | system_mtime | user_mtime | type_id | +-------+---------+--------------+---------------------+---------+----------------+-------------+-----------------+-----------+------------+------------------+---------------------+---------------------+---------------------+---------+ | 74473 | 4 | 2 | 1 | NULL | NULL | NULL | NULL | 4 | huabowers | huabowers | 2017-07-14 16:21:31 | 2017-07-14 17:34:22 | 2017-07-14 16:21:31 | 23372 | +-------+---------+--------------+---------------------+---------+----------------+-------------+-----------------+-----------+------------+------------------+---------------------+---------------------+---------------------+---------+
Need to do better checking of top containers!
hunt_error.xlsx
Problem because the top_container_handler is global; need to add the resource to the tc_key to pick up the right one.
Re-thinking exactly what constitutes a "match" with top containers
Decided to go with the "match only if the container is linked to that Resource", but added a note about sharing containers in the User Documentation