% nr_successful = results.count { |r| r[:success] } %>
<% failed = results.select { |r| !r[:success] } %>
<% unchanged = results.select { |r| r[:success] && r[:name] == r[:new_name] } %>
<% renamed = results.select { |r| r[:success] && r[:name] != r[:new_name] } %>
<% if failed.count > 0 %>
<%= t("protocols.index.#{en_action}.message_failed", nr: failed.count) %>
<% end %>
<% if nr_successful > 0 %>
<%= t("protocols.index.#{en_action}.message_ok", nr: nr_successful) %>
<% end %>
<% if unchanged.count > 0 %>
<% unchanged.each do |r| %>
-
<%= t("protocols.index.#{en_action}.row_success") %>
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: h(r[:name])).html_safe %>
<% else %>
<%= r[:name] %>
<% end %>
<% end %>
<% end %>
<% if renamed.count > 0 %>
<% renamed.each do |r| %>
-
<%= t("protocols.index.#{en_action}.row_renamed") %>
<% protocol_str = t("protocols.index.row_renamed_html", old_name: h(r[:name]), new_name: h(r[:new_name])) %>
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: protocol_str).html_safe %>
<% else %>
<%= protocol_str.html_safe %>
<% end %>
<% end %>
<% end %>
<% if failed.count > 0 %>
<% failed.each do |r| %>
-
<%= t("protocols.index.#{en_action}.row_failed") %>
<%= r[:name] %>
<% end %>
<% end %>