Skip to content

Commit

Permalink
Merge pull request #1723 from pulibrary/issue_1722_av
Browse files Browse the repository at this point in the history
Handles availability for new work order type
  • Loading branch information
christinach authored Oct 21, 2021
2 parents 1733b46 + 948399b commit ca1b894
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/adapters/alma_adapter/alma_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def status_from_work_order_type

# Source for values: https://developers.exlibrisgroup.com/alma/apis/docs/xsd/rest_item.xsd/
# and https://api-na.hosted.exlibrisgroup.com/almaws/v1/conf/departments?apikey=YOUR-KEY&format=json
code = if value == "Bind" || value == "Pres" || value == "CDL" || value == "AcqWorkOrder"
code = if value.in?(["Bind", "Pres", "CDL", "AcqWorkOrder", "CollDev"])
"Not Available"
else
# "COURSE" or "PHYSICAL_TO_DIGITIZATION"
Expand Down
20 changes: 20 additions & 0 deletions spec/adapters/alma_adapter/alma_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ def build_item(code:)
)
end

let(:item_work_order_coll_dev) do
Alma::BibItem.new(
"bib_data" => { "mms_id" => "99122455086806421" },
"holding_data" => { "holding_id" => "22477860740006421" },
"item_data" => {
"pid" => "23477860730006421",
"base_status" => { "value" => "0", "desc" => "Item not in place" },
"process_type" => { "value" => "WORK_ORDER_DEPARTMENT", "desc" => "In Process" },
"work_order_type" => { "value" => "CollDev", "desc" => "Collection Development Office" },
"work_order_at" => { "value" => "CollDev", "desc" => "Collection Development Office" }
}
)
end

let(:item_process_type_acq) do
Alma::BibItem.new(
"bib_data" => { "mms_id" => "9939075533506421" },
Expand Down Expand Up @@ -172,6 +186,12 @@ def build_item(code:)
expect(status[:code]).to eq "Not Available"
end

it "handles items with work order in collection development" do
item = described_class.new(item_work_order_coll_dev)
status = item.calculate_status
expect(status[:code]).to eq "Not Available"
end

it "handles items with process type in acquisitions" do
item = described_class.new(item_process_type_acq)
status = item.calculate_status
Expand Down

0 comments on commit ca1b894

Please sign in to comment.