<%= form_with url: form_url, method: form_method, local: true do |f| %> <% ScoringCriterium.grouped_by_category.each do |category, criteria| %>
<%= category.titlecase %> <% criteria.each do |criterium| %> <% current_score = existing_scores.find { |score| score.scoring_criterium_id == criterium.id } %>

<%= select_tag "scores[#{criterium.id}][value]", options_for_select(1..5, current_score&.value), required: true, prompt: "Score" %> <%= label_tag "scores[#{criterium.id}][value]", criterium.name.capitalize %>

<% end %>
<% end %> <%= f.submit submit_text %> <% end %>