mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-14 08:58:29 +00:00
Fixed reset password after the Devise migration.
This commit is contained in:
@@ -9,8 +9,31 @@ class AdvanceWrestlerJob < ApplicationJob
|
||||
end
|
||||
|
||||
def perform(wrestler, match)
|
||||
# Execute the job
|
||||
service = AdvanceWrestler.new(wrestler, match)
|
||||
service.advance_raw
|
||||
# Get tournament from wrestler
|
||||
tournament = wrestler.tournament
|
||||
|
||||
# Create job status record
|
||||
job_name = "Advancing wrestler #{wrestler.name}"
|
||||
job_status = TournamentJobStatus.create!(
|
||||
tournament: tournament,
|
||||
job_name: job_name,
|
||||
status: "Running",
|
||||
details: "Match ID: #{match.bout_number}"
|
||||
)
|
||||
|
||||
begin
|
||||
# Execute the job
|
||||
service = AdvanceWrestler.new(wrestler, match)
|
||||
service.advance_raw
|
||||
|
||||
# Remove the job status record on success
|
||||
TournamentJobStatus.complete_job(tournament.id, job_name)
|
||||
rescue => e
|
||||
# Update status to errored
|
||||
job_status.update(status: "Errored", details: "Error: #{e.message}")
|
||||
|
||||
# Re-raise the error for SolidQueue to handle
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,28 @@ class CalculateSchoolScoreJob < ApplicationJob
|
||||
# Log information about the job
|
||||
Rails.logger.info("Calculating score for school ##{school.id} (#{school.name})")
|
||||
|
||||
# Execute the calculation
|
||||
school.calculate_score_raw
|
||||
# Create job status record
|
||||
tournament = school.tournament
|
||||
job_name = "Calculating team score for #{school.name}"
|
||||
job_status = TournamentJobStatus.create!(
|
||||
tournament: tournament,
|
||||
job_name: job_name,
|
||||
status: "Running",
|
||||
details: "School ID: #{school.id}"
|
||||
)
|
||||
|
||||
begin
|
||||
# Execute the calculation
|
||||
school.calculate_score_raw
|
||||
|
||||
# Remove the job status record on success
|
||||
TournamentJobStatus.complete_job(tournament.id, job_name)
|
||||
rescue => e
|
||||
# Update status to errored
|
||||
job_status.update(status: "Errored", details: "Error: #{e.message}")
|
||||
|
||||
# Re-raise the error for SolidQueue to handle
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,8 +12,28 @@ class TournamentBackupJob < ApplicationJob
|
||||
# Log information about the job
|
||||
Rails.logger.info("Creating backup for tournament ##{tournament.id} (#{tournament.name}), reason: #{reason || 'manual'}")
|
||||
|
||||
# Execute the backup
|
||||
service = TournamentBackupService.new(tournament, reason)
|
||||
service.create_backup_raw
|
||||
# Create job status record
|
||||
job_name = "Backing up tournament"
|
||||
job_status = TournamentJobStatus.create!(
|
||||
tournament: tournament,
|
||||
job_name: job_name,
|
||||
status: "Running",
|
||||
details: "Reason: #{reason || 'manual'}"
|
||||
)
|
||||
|
||||
begin
|
||||
# Execute the backup
|
||||
service = TournamentBackupService.new(tournament, reason)
|
||||
service.create_backup_raw
|
||||
|
||||
# Remove the job status record on success
|
||||
TournamentJobStatus.complete_job(tournament.id, job_name)
|
||||
rescue => e
|
||||
# Update status to errored
|
||||
job_status.update(status: "Errored", details: "Error: #{e.message}")
|
||||
|
||||
# Re-raise the error for SolidQueue to handle
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -13,9 +13,29 @@ class WrestlingdevImportJob < ApplicationJob
|
||||
# Log information about the job
|
||||
Rails.logger.info("Starting import for tournament ##{tournament.id} (#{tournament.name})")
|
||||
|
||||
# Execute the import
|
||||
importer = WrestlingdevImporter.new(tournament)
|
||||
importer.import_data = import_data if import_data
|
||||
importer.import_raw
|
||||
# Create job status record
|
||||
job_name = "Importing tournament"
|
||||
job_status = TournamentJobStatus.create!(
|
||||
tournament: tournament,
|
||||
job_name: job_name,
|
||||
status: "Running",
|
||||
details: "Processing backup data"
|
||||
)
|
||||
|
||||
begin
|
||||
# Execute the import
|
||||
importer = WrestlingdevImporter.new(tournament)
|
||||
importer.import_data = import_data if import_data
|
||||
importer.import_raw
|
||||
|
||||
# Remove the job status record on success
|
||||
TournamentJobStatus.complete_job(tournament.id, job_name)
|
||||
rescue => e
|
||||
# Update status to errored
|
||||
job_status.update(status: "Errored", details: "Error: #{e.message}")
|
||||
|
||||
# Re-raise the error for SolidQueue to handle
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user