From 948399b012266bb7985585ec30356949b5246268 Mon Sep 17 00:00:00 2001 From: Hector Correa Date: Thu, 21 Oct 2021 15:59:56 -0400 Subject: [PATCH] Handles new work order type --- app/adapters/alma_adapter/alma_item.rb | 2 +- spec/adapters/alma_adapter/alma_item_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/adapters/alma_adapter/alma_item.rb b/app/adapters/alma_adapter/alma_item.rb index d3c045dc..09ceb94e 100644 --- a/app/adapters/alma_adapter/alma_item.rb +++ b/app/adapters/alma_adapter/alma_item.rb @@ -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" diff --git a/spec/adapters/alma_adapter/alma_item_spec.rb b/spec/adapters/alma_adapter/alma_item_spec.rb index 63f35922..4d4f9544 100644 --- a/spec/adapters/alma_adapter/alma_item_spec.rb +++ b/spec/adapters/alma_adapter/alma_item_spec.rb @@ -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" }, @@ -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