From b4bca8f10afef2e1dab99cd11fae5c293c2ba655 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Sat, 10 Jan 2026 23:39:23 -0500 Subject: [PATCH] Fixed calculate team scores button, fixed import button, fixed deleting a mat causing match deletes --- app/models/mat.rb | 2 +- app/views/layouts/_tournament-navbar.html.erb | 2 +- app/views/tournament_backups/index.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/mat.rb b/app/models/mat.rb index 58ca2b9..7d7bbfe 100644 --- a/app/models/mat.rb +++ b/app/models/mat.rb @@ -1,6 +1,6 @@ class Mat < ApplicationRecord belongs_to :tournament - has_many :matches, dependent: :destroy + has_many :matches, dependent: :nullify has_many :mat_assignment_rules, dependent: :destroy validates :name, presence: true diff --git a/app/views/layouts/_tournament-navbar.html.erb b/app/views/layouts/_tournament-navbar.html.erb index df0814c..e56096d 100644 --- a/app/views/layouts/_tournament-navbar.html.erb +++ b/app/views/layouts/_tournament-navbar.html.erb @@ -60,7 +60,7 @@
  • <%= link_to "Create Boys Middle School Weights (80-245)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::MS_WEIGHT_CLASSES}",data: { turbo_method: :get, turbo_confirm: 'Are you sure? This will delete all current weights.' } %>
  • <%= link_to "Create Girls Middle School Weights (72-235)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::MS_GIRLS_WEIGHT_CLASSES}",data: { turbo_method: :get, turbo_confirm: 'Are you sure? This will delete all current weights.' } %>
  • Tournament Actions
  • -
  • <%= link_to "Calculate Team Scores" , "/tournaments/#{@tournament.id}/calculate_team_scores", :method => :put %>
  • +
  • <%= link_to "Calculate Team Scores" , "/tournaments/#{@tournament.id}/calculate_team_scores", data: { turbo_method: :put } %>
  • <%= link_to "Generate Brackets" , "/tournaments/#{@tournament.id}/generate_matches", data: { turbo_method: :get, turbo_confirm: 'Are you sure? This will delete all current matches.' } %>
  • <%= link_to "Export Data" , "/tournaments/#{@tournament.id}/export?print=true", target: :_blank %>
  • diff --git a/app/views/tournament_backups/index.html.erb b/app/views/tournament_backups/index.html.erb index dedf592..1b496f8 100644 --- a/app/views/tournament_backups/index.html.erb +++ b/app/views/tournament_backups/index.html.erb @@ -34,5 +34,5 @@ and will also delete all of your current data. It's best to use the create backu <%= f.label 'Import text' %>
    <%= f.text_area :import_text, cols: "30", rows: "20" %> - <%= submit_tag "Import", class: "btn btn-success", data: { confirm: 'Are you sure? This will delete everything for the current tournament and restore it with the backup text pasted below.' } %> + <%= submit_tag "Import", class: "btn btn-success", data: { turbo_confirm: 'Are you sure? This will delete everything for the current tournament and restore it with the backup text pasted below.' } %> <% end %>