d24ee27cac
Only fetch external data if the external_id is the current one and data is not yet fetched
11 lines
267 B
Ruby
11 lines
267 B
Ruby
class ChampFetchExternalDataJob < ApplicationJob
|
|
def perform(champ, external_id)
|
|
if champ.external_id == external_id && champ.data.nil?
|
|
data = champ.fetch_external_data
|
|
|
|
if data.present?
|
|
champ.update!(data: data)
|
|
end
|
|
end
|
|
end
|
|
end
|