1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-02 13:15:27 +00:00

Fixed double elim bracket views, fixed double elim match generation and loser name generation for 4 man bracket, fixed seed page submission and added tests, added tests for tournament generation errors and added a new error for assigning a seed higher than the number of wrestlers.

This commit is contained in:
2024-12-08 19:29:56 -05:00
parent f6ef471591
commit f18802a933
10 changed files with 278 additions and 37 deletions

View File

@@ -8,15 +8,21 @@ class WeightsController < ApplicationController
# GET /weights/1.json
def show
if params[:wrestler]
check_access_manage
respond_to do |format|
Wrestler.update(params[:wrestler].keys, params[:wrestler].values)
# Sanitize the wrestler parameters
sanitized_wrestlers = params.require(:wrestler).to_unsafe_h.transform_values do |attributes|
ActionController::Parameters.new(attributes).permit(:original_seed)
end
Wrestler.update(sanitized_wrestlers.keys, sanitized_wrestlers.values)
format.html { redirect_to @weight, notice: 'Seeds were successfully updated.' }
end
end
@wrestlers = @weight.wrestlers
@tournament = @weight.tournament
session[:return_path] = "/weights/#{@weight.id}"
end
end
# GET /weights/new
def new