<% political_membership = role_appointment.historical_account.try(:political_membership) %>
<%= content_tag_for :div, role_appointment, class: 'govuk-grid-column-one-quarter', role: "listitem" do %>
  <% if role_appointment.has_historical_account? %>
    <%= render "govuk_publishing_components/components/image_card", {
      href: historic_appointment_path(role.historic_param, role_appointment.person),
      image_src: role_appointment.person.image_url(:s216),
      image_loading: "lazy",
      heading_text: role_appointment.person.name,
      extra_details: previous_dates_in_office_prime(role, role_appointment.person, political_membership),
      extra_details_no_indent: true
    } %>
  <% else %>
    <%= render "govuk_publishing_components/components/image_card", {
      image_src: role_appointment.person.image_url(:s216),
      image_loading: "lazy",
      heading_text: role_appointment.person.name,
      extra_details: previous_dates_in_office_prime(role, role_appointment.person, political_membership),
      extra_details_no_indent: true
    } %>
  <% end %>
<% end %>

<% political_membership = role_appointment.historical_account.try(:political_membership) %>
<%= content_tag_for :div, role_appointment, class: 'govuk-grid-column-one-quarter', role: "listitem" do %>
  <% if role_appointment.has_historical_account? %>
    <%= render "govuk_publishing_components/components/image_card", {
      href: historic_appointment_path(role_appointment.person),
      image_src: role_appointment.person.image_url(:s216),
      image_loading: "lazy",
      heading_text: role_appointment.person.name,
      extra_details: previous_dates_in_office_prime(role, role_appointment.person, political_membership),
      extra_details_no_indent: true
    } %>
  <% else %>
    <%= render "govuk_publishing_components/components/image_card", {
      image_src: role_appointment.person.image_url(:s216),
      image_loading: "lazy",
      heading_text: role_appointment.person.name,
      extra_details: previous_dates_in_office_prime(role, role_appointment.person, political_membership),
      extra_details_no_indent: true
    } %>
  <% end %>
<% end %>

Fix past prime minister href
Fix past prime minister href
