mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Fixed mat assignment rules to be db agnostic with comma delimited strings and upgraded test env db to mariadb 10.10 to match production.
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
<div>
|
||||
<%= form.label :weight_classes, "Allowed Weight Classes" %><br>
|
||||
<% if @tournament.weights.any? %>
|
||||
<% @tournament.weights.each do |weight| %>
|
||||
<% @tournament.weights.sort_by{|w| w.max}.each do |weight| %>
|
||||
<div>
|
||||
<%= check_box_tag "mat_assignment_rule[weight_classes][]", weight.id, @mat_assignment_rule.weight_classes.map(&:to_i).include?(weight.id) %>
|
||||
<%= check_box_tag "mat_assignment_rule[weight_classes][]", weight.id, Array(@mat_assignment_rule.weight_classes).map(&:to_i).include?(weight.id) %>
|
||||
<%= label_tag "mat_assignment_rule_weight_classes_#{weight.id}", weight.max %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -30,7 +30,7 @@
|
||||
<% if @unique_bracket_positions.present? %>
|
||||
<% @unique_bracket_positions.each do |position| %>
|
||||
<div>
|
||||
<%= check_box_tag "mat_assignment_rule[bracket_positions][]", position, @mat_assignment_rule.bracket_positions.include?(position) %>
|
||||
<%= check_box_tag "mat_assignment_rule[bracket_positions][]", position, Array(@mat_assignment_rule.bracket_positions).include?(position) %>
|
||||
<%= label_tag "mat_assignment_rule_bracket_positions_#{position}", position %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -45,7 +45,7 @@
|
||||
<% if @unique_rounds.present? %>
|
||||
<% @unique_rounds.each do |round| %>
|
||||
<div>
|
||||
<%= check_box_tag "mat_assignment_rule[rounds][]", round, @mat_assignment_rule.rounds.map(&:to_i).include?(round) %>
|
||||
<%= check_box_tag "mat_assignment_rule[rounds][]", round, Array(@mat_assignment_rule.rounds).map(&:to_i).include?(round) %>
|
||||
<%= label_tag "mat_assignment_rule_rounds_#{round}", round %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -5,30 +5,25 @@
|
||||
<th>Weight Classes (Max)</th>
|
||||
<th>Bracket Positions</th>
|
||||
<th>Rounds</th>
|
||||
<th><%= link_to ' New Mat Assignment Rule', new_tournament_mat_assignment_rule_path(@tournament), :class=>"fas fa-plus" %></th>
|
||||
<th><%= link_to ' New Mat Assignment Rule', new_tournament_mat_assignment_rule_path(@tournament), class: "fas fa-plus" %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @mat_assignment_rules.each do |rule| %>
|
||||
<tr>
|
||||
<td><%= rule.mat.name %></td>
|
||||
|
||||
<!-- Display max values for each weight associated with the rule -->
|
||||
<td>
|
||||
<% rule.weight_classes.each do |weight_id| %>
|
||||
<% weight = @weights_by_id[weight_id] %>
|
||||
<%= weight ? weight.max : "N/A" %><%= ", " unless weight_id == rule.weight_classes.last %>
|
||||
<% Array(rule.weight_classes).each_with_index do |weight_id, index| %>
|
||||
<% weight = @weights_by_id[weight_id.to_i] %>
|
||||
<%= weight ? weight.max : "N/A" %>
|
||||
<%= ", " unless index == Array(rule.weight_classes).size - 1 %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
<!-- Display bracket positions and rounds -->
|
||||
<td><%= rule.bracket_positions.join(", ") %></td>
|
||||
<td><%= rule.rounds.join(", ") %></td>
|
||||
|
||||
<!-- Edit and Delete Actions -->
|
||||
<td><%= Array(rule.bracket_positions).join(", ") %></td>
|
||||
<td><%= Array(rule.rounds).join(", ") %></td>
|
||||
<td>
|
||||
<%= link_to '', edit_tournament_mat_assignment_rule_path(@tournament, rule), :class=>"fas fa-edit" %>
|
||||
<%= link_to '', tournament_mat_assignment_rule_path(@tournament, rule), method: :delete, data: { confirm: "Are you sure?" }, :class=>"fas fa-trash-alt" %>
|
||||
<%= link_to '', edit_tournament_mat_assignment_rule_path(@tournament, rule), class: "fas fa-edit" %>
|
||||
<%= link_to '', tournament_mat_assignment_rule_path(@tournament, rule), method: :delete, data: { confirm: "Are you sure?" }, class: "fas fa-trash-alt" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user