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

fix: add yearCaption, enumeration and chronology to request notes #713

Merged
merged 1 commit into from
Sep 3, 2023
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
13 changes: 12 additions & 1 deletion app/components/request_table_row_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
<td><%= link_to_record %></td>
<td><%= @request_details.pickupServicePoint %></td>
<td>
<p><%= @request_details.patronComments %></p>
<%- if @request_details.yearCaption %>
<p><%= @request_details.yearCaption %></p>
<%- end %>
<%- if @request_details.enumeration %>
<p><%= @request_details.enumeration %></p>
<%- end %>
<%- if @request_details.chronology %>
<p><%= @request_details.chronology %></p>
<%- end %>
<%- if @request_details.patronComments %>
<p><%= @request_details.patronComments %></p>
<%- end %>
<%- if @request_details.cancellationReason.present? %>
<p><%= @request_details.cancellationReason %></p>
<%- end %>
Expand Down
2 changes: 1 addition & 1 deletion app/models/request_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class RequestDetail

attr_reader :details, :record_id, :date

delegate :instanceId, :title, :callNumber, :enumeration, :pickupServicePoint, :patronComments, :requestDate, :cancellationComment, :cancellationReason, to: :details
delegate :requestDate, :title, :patronComments, :instanceId, :yearCaption, :enumeration, :chronology, :callNumber, :status, :pickupServicePoint, :cancellationComment, :cancellationReason, to: :details

def initialize(details)
@details = details
Expand Down
18 changes: 18 additions & 0 deletions spec/components/request_table_row_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@
expect(page).to have_css("small.text-muted", text: "06:36:33pm")
end

it "renders the year in the notes column" do
render_inline(described_class.new(request_data))

expect(page).to have_css("p", text: "1909")
end

it "renders the enumeration in the notes column" do
render_inline(described_class.new(request_data))

expect(page).to have_css("p", text: "pbk")
end

it "renders the chronology in the notes column" do
render_inline(described_class.new(request_data))

expect(page).to have_css("p", text: "June, July")
end

def request_data
data = IO.read("spec/files/account/single_request.json")
{request: JSON.parse(data)}
Expand Down
2 changes: 2 additions & 0 deletions spec/files/account/single_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"title": "The Mad Max movies / Adrian Martin.",
"patronComments": "Testing patron comments",
"instanceId": "4a05cad3-5269-5a5e-90f6-2ab0ccce6861",
"yearCaption": "1909",
"enumeration": "pbk",
"chronology": "June, July",
"callNumber": "N N 791.43720994 M379",
"status": "Open - Not yet filled",
"pickupServicePoint": "Main Reading Room"
Expand Down