vol1ura/Sat_9am_5km

View on GitHub
app/jobs/athlete_stats_update_job.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

class AthleteStatsUpdateJob < ApplicationJob
  queue_as :low

  def perform(athlete_ids = nil)
    dataset = Athlete.all
    dataset = dataset.where(id: athlete_ids) if athlete_ids

    dataset.find_each do |athlete|
      Athletes::StatsUpdate.call(athlete)
    end
  end
end