2021-02-09 12:35:23 +01:00
|
|
|
class ChampFetchExternalDataJob < ApplicationJob
|
2021-03-11 12:32:08 +01:00
|
|
|
def perform(champ, external_id)
|
2023-02-28 13:55:52 +01:00
|
|
|
return if champ.external_id != external_id
|
|
|
|
return if champ.data.present?
|
|
|
|
return if (data = champ.fetch_external_data).blank?
|
2021-02-09 12:35:23 +01:00
|
|
|
|
2023-02-28 13:55:52 +01:00
|
|
|
champ.update_with_external_data!(data: data)
|
2021-02-09 12:35:23 +01:00
|
|
|
end
|
|
|
|
end
|