Skip to content

Commit

Permalink
- Fix asking member & question text partial issues where an oral answ…
Browse files Browse the repository at this point in the history
…er does not have the required question data associated with it
  • Loading branch information
j-corry committed Sep 13, 2024
1 parent 2a6b57f commit 279d06b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/views/search/fragments/_corrected_answer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% end %>
<% unless object.correcting_item_link.blank? %>
<p class="html-content">
<%= raw(@associated_object_data[object.correcting_item_link].correction_text[:value]) %>
<%= raw(@associated_object_data[object.correcting_item_link]&.correction_text[:value]) %>
</p>
<% end %>
</div>
Expand Down
46 changes: 24 additions & 22 deletions app/views/search/fragments/_regarding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
<h3 class="content-heading" id="regarding-deposited-document">Regarding deposited document</h3>
<div class="flex-list">
<% regarding_object_ids.each do |r_id| %>
<div>
<% unless @associated_object_data[r_id].object_uri.blank? %>
<%= object_show_link(@associated_object_data[r_id].object_title, @associated_object_data[r_id].object_uri) %>
<br/>
<% end %>
<% if @associated_object_data[r_id].date %>
<%= format_date(@associated_object_data[r_id].date) %><br/>
<% end %>
<% if @associated_object_data[r_id].dual_type? %>
<%= @ses_data[@associated_object_data[r_id].subtype[:value]] %>
and <%= @ses_data[@associated_object_data[r_id].type[:value]] %><br/>
<% else %>
<% if @associated_object_data[r_id].subtype %>
<%= @ses_data[@associated_object_data[r_id].subtype[:value]] %><br/>
<% elsif @associated_object_data[r_id].type %>
<%= @ses_data[@associated_object_data[r_id].type[:value]] %><br/>
<% unless @associated_object_data[r_id].blank? %>
<div>
<% unless @associated_object_data[r_id].object_uri.blank? %>
<%= object_show_link(@associated_object_data[r_id].object_title, @associated_object_data[r_id].object_uri) %>
<br/>
<% end %>
<% end %>
<% unless @associated_object_data[r_id].legislature.blank? %>
<% @associated_object_data[r_id].legislature.each do |house| %>
<%= @ses_data[house[:value]] %><br/>
<% if @associated_object_data[r_id].date %>
<%= format_date(@associated_object_data[r_id].date) %><br/>
<% end %>
<% end %>
</div>
<% if @associated_object_data[r_id].dual_type? %>
<%= @ses_data[@associated_object_data[r_id].subtype[:value]] %>
and <%= @ses_data[@associated_object_data[r_id].type[:value]] %><br/>
<% else %>
<% if @associated_object_data[r_id].subtype %>
<%= @ses_data[@associated_object_data[r_id].subtype[:value]] %><br/>
<% elsif @associated_object_data[r_id].type %>
<%= @ses_data[@associated_object_data[r_id].type[:value]] %><br/>
<% end %>
<% end %>
<% unless @associated_object_data[r_id].legislature.blank? %>
<% @associated_object_data[r_id].legislature.each do |house| %>
<%= @ses_data[house[:value]] %><br/>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/search/results/_oral_answer_to_question.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
<div class="centre" id="secondary-person">
<div <%= 'hidden' unless params[:show_detailed] == "true" %> data-detailed-results-target="toggleHidden">
<%= render 'search/results/item_details/asking_member', asking_member: @associated_object_data[object.question_id].asking_member, asking_member_party: @associated_object_data[object.question_id].asking_member_party, label: 'Asked by' %>
<%= render 'search/results/item_details/asking_member', asking_member: @associated_object_data[object.question_id]&.asking_member, asking_member_party: @associated_object_data[object.question_id]&.asking_member_party, label: 'Asked by' %>
</div>
</div>
<div class="right" id="primary-group">
Expand Down Expand Up @@ -74,7 +74,7 @@

<div class="row">
<div id="supplementary-content">
<%= render 'search/results/item_details/question_text', question_text: @associated_object_data[object.question_id].question_text %>
<%= render 'search/results/item_details/question_text', question_text: @associated_object_data[object.question_id]&.question_text %>
</div>
</div>

Expand Down

0 comments on commit 279d06b

Please sign in to comment.