mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-12 16:25:41 +00:00
Refactored match winner and wrestlers matches and fixed slow tests.
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
class AdvanceWrestlerJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
def self.perform_sync(wrestler, match)
|
||||
# Execute directly on provided objects
|
||||
service = AdvanceWrestler.new(wrestler, match)
|
||||
service.advance_raw
|
||||
end
|
||||
|
||||
def perform(wrestler, match)
|
||||
# Add a small delay to increase chance of transaction commit
|
||||
# without this some matches were getting a deserialization error when running the rake task
|
||||
# to finish tournaments
|
||||
sleep(0.5)
|
||||
sleep(0.5) unless Rails.env.test?
|
||||
|
||||
# Get tournament from wrestler
|
||||
tournament = wrestler.tournament
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class CalculateSchoolScoreJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
# Need for TournamentJobStatusIntegrationTest
|
||||
def self.perform_sync(school)
|
||||
# Execute directly on provided objects
|
||||
school.calculate_score_raw
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
class GenerateTournamentMatchesJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
def self.perform_sync(tournament)
|
||||
# Execute directly on provided objects
|
||||
generator = GenerateTournamentMatches.new(tournament)
|
||||
generator.generate_raw
|
||||
end
|
||||
|
||||
def perform(tournament)
|
||||
# Log information about the job
|
||||
Rails.logger.info("Starting tournament match generation for tournament ##{tournament.id}")
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
class TournamentBackupJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
def self.perform_sync(tournament, reason = nil)
|
||||
# Execute directly on provided objects
|
||||
service = TournamentBackupService.new(tournament, reason)
|
||||
service.create_backup_raw
|
||||
end
|
||||
|
||||
def perform(tournament, reason = nil)
|
||||
# Log information about the job
|
||||
Rails.logger.info("Creating backup for tournament ##{tournament.id} (#{tournament.name}), reason: #{reason || 'manual'}")
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
class WrestlingdevImportJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
def self.perform_sync(tournament, import_data = nil)
|
||||
# Execute directly on provided objects
|
||||
importer = WrestlingdevImporter.new(tournament)
|
||||
importer.import_data = import_data if import_data
|
||||
importer.import_raw
|
||||
end
|
||||
|
||||
def perform(tournament, import_data = nil)
|
||||
# Log information about the job
|
||||
Rails.logger.info("Starting import for tournament ##{tournament.id} (#{tournament.name})")
|
||||
|
||||
Reference in New Issue
Block a user