1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Upgraded to rails 8.0.2, moved from dalli to solid cache, moved from delayed_job to solid queue, and add solid cable. deploy/rails-dev-run.sh no longer needs to chmod. Fixed finished_at callback for matches. Migrated from Devise to built in rails auth. Added view tests for the bracket page testing that all bout numbers render for all matches in each bracket type.

This commit is contained in:
2025-04-08 17:54:42 -04:00
parent 9c25a6cc39
commit 2d433b680a
118 changed files with 4921 additions and 1341 deletions

View File

@@ -1,20 +1,18 @@
class AdvanceWrestler
def initialize( wrestler, last_match )
def initialize(wrestler, last_match)
@wrestler = wrestler
@tournament = @wrestler.tournament
@last_match = last_match
end
def advance
if Rails.env.production?
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Advance wrestler #{@wrestler.name} in the bracket").advance_raw
else
advance_raw
end
# Use perform_later which will execute based on centralized adapter config
# This will be converted to inline execution in test environment by ActiveJob
AdvanceWrestlerJob.perform_later(@wrestler, @last_match)
end
def advance_raw
@tournament.clear_errored_deferred_jobs
if @last_match && @last_match.finished?
pool_to_bracket_advancement if @tournament.tournament_type == "Pool to bracket"
ModifiedDoubleEliminationAdvance.new(@wrestler, @last_match).bracket_advancement if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"

View File

@@ -4,11 +4,8 @@ class GenerateTournamentMatches
end
def generate
if Rails.env.production?
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Generate matches for all weights").generate_raw
else
self.generate_raw
end
# Use perform_later which will execute based on centralized adapter config
GenerateTournamentMatchesJob.perform_later(@tournament)
end
def generate_raw

View File

@@ -5,11 +5,8 @@ class TournamentBackupService
end
def create_backup
if Rails.env.production?
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Create a backup").create_backup_raw
else
self.create_backup_raw
end
# Use perform_later which will execute based on centralized adapter config
TournamentBackupJob.perform_later(@tournament, @reason)
end
def create_backup_raw

View File

@@ -1,19 +1,24 @@
class WrestlingdevImporter
##### Note, the json contains id's for each row in the tables as well as its associations
##### this ignores those ids and uses this tournament id and then looks up associations based on name
##### and this tournament id
def initialize(tournament, backup)
attr_accessor :import_data
# Support both parameter styles for backward compatibility
# Old: initialize(tournament, backup)
# New: initialize(tournament) with import_data setter
def initialize(tournament, backup = nil)
@tournament = tournament
@import_data = JSON.parse(Base64.decode64(backup.backup_data))
# Handle the old style where backup was passed directly
if backup.present?
@import_data = JSON.parse(Base64.decode64(backup.backup_data)) rescue nil
end
end
def import
if Rails.env.production?
self.delay(job_owner_id: @tournament.id, job_owner_type: "Importing a backup").import_raw
else
import_raw
end
# Use perform_later which will execute based on centralized adapter config
WrestlingdevImportJob.perform_later(@tournament, @import_data)
end
def import_raw