Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIBSEARCH-795 ILLiad renew text #237

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .irbrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require_relative "my_account"
require_relative "account"
8 changes: 6 additions & 2 deletions models/items/interlibrary_loan/interlibrary_loan_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def url_cancel_request
illiad_url(21, 10, true)
end

def url_request_renewal
illiad_url(10, 72)
def renew_text
if renewable?
"Yes - select title to request renewal"
else
"No - not eligible for renewal"
end
end

def creation_date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
expect(subject.url_cancel_request).to eq("https://ill.lib.umich.edu/illiad/illiad.dll?Action=21&Type=10&Value=3298020")
end
end
context "#url_request_renewal" do
it "returns url to the form to request a renewal of the ILLiad transaction" do
expect(subject.url_request_renewal).to eq("https://ill.lib.umich.edu/illiad/illiad.dll?Action=10&Form=72&Value=3298020")
end
end
context "#creation_date" do
it "returns creation date string" do
expect(subject.creation_date).to eq("03/09/21")
Expand Down Expand Up @@ -77,6 +72,15 @@
expect(subject.transaction_date).to eq("03/09/21")
end
end
context "#renew_text" do
it "returns correct text when renewable" do
@item["RenewalsAllowed"] = true
expect(subject.renew_text).to eq("Yes - select title to request renewal")
end
it "returns correct text when not_renewable" do
expect(subject.renew_text).to eq("No - not eligible for renewal")
end
end
context "#renewable?" do
it "returns a boolean" do
expect(subject.renewable?).to eq(false)
Expand Down
8 changes: 2 additions & 6 deletions views/current-checkouts/interlibrary-loan.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<tr>
<th>Title &amp; author</th>
<th>Due date</th>
<th>Action</th>
<th>Eligible for renewal</th>
</tr>
</thead>
<tbody>
Expand All @@ -34,11 +34,7 @@
<% end %>
</td>
<td class="table-cell-action">
<% if interlibrary_loan.renewable? %>
<a href="<%= interlibrary_loan.url_request_renewal %>">Request Renewal</a>
<% else %>
<p>Not eligible for renewal</p>
<% end %>
<%= interlibrary_loan.renew_text %>
</td>
</tr>
<% end %>
Expand Down
8 changes: 2 additions & 6 deletions views/current-checkouts/scans-and-electronic-items.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<tr>
<th>Title & author</th>
<th>Expires</th>
<th>Action</th>
<th>Eligible for renewal</th>
</tr>
</thead>
<tbody>
Expand All @@ -30,11 +30,7 @@
<%= delivery.expiration_date %>
</td>
<td class="table-cell-action">
<% if delivery.renewable? %>
<a href="<%= delivery.url_request_renewal %>">Request Renewal</a>
<% else %>
<p>Not eligible for renewal</p>
<% end %>
<%= interlibrary_loan.renew_text %>
</td>
</tr>
<% end %>
Expand Down