Skip to content

Commit

Permalink
fix: changes illiad renew to a direction instead of a link
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Oct 17, 2022
1 parent 29480d8 commit 9fcd2a5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
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

0 comments on commit 9fcd2a5

Please sign in to comment.