f52554b5a3
1 - spec cover the job which fetches external data 2 - refactor the job with guard clauses 3 - delegate update operation to the champ itself 4 - annuaire education: override the update operation to let the value be populated by the fetched data 5 - prefilling: don't fetch data synchronously
9 lines
280 B
Ruby
9 lines
280 B
Ruby
class ChampFetchExternalDataJob < ApplicationJob
|
|
def perform(champ, external_id)
|
|
return if champ.external_id != external_id
|
|
return if champ.data.present?
|
|
return if (data = champ.fetch_external_data).blank?
|
|
|
|
champ.update_with_external_data!(data: data)
|
|
end
|
|
end
|