Merge pull request #5246 from betagouv/effectifs_avril
ask only effectifs for april
This commit is contained in:
commit
b264839039
3 changed files with 5 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
class ApiEntreprise::EffectifsJob < ApiEntreprise::Job
|
||||
def perform(etablissement_id, procedure_id)
|
||||
etablissement = Etablissement.find(etablissement_id)
|
||||
# effectifs endpoint currently only works when asking for february 2020 month
|
||||
etablissement_params = ApiEntreprise::EffectifsAdapter.new(etablissement.siret, procedure_id, "2020", "02").to_params
|
||||
# april 2020 is at the moment the most actual info for effectifs endpoint
|
||||
etablissement_params = ApiEntreprise::EffectifsAdapter.new(etablissement.siret, procedure_id, "2020", "04").to_params
|
||||
etablissement.update!(etablissement_params)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ class ApiEntreprise::EffectifsAdapter < ApiEntreprise::Adapter
|
|||
if data_source[:effectifs_mensuels].present?
|
||||
{
|
||||
entreprise_effectif_mensuel: data_source[:effectifs_mensuels],
|
||||
entreprise_effectif_mois: @mois,
|
||||
entreprise_effectif_annee: @annee
|
||||
entreprise_effectif_mois: data_source[:mois],
|
||||
entreprise_effectif_annee: data_source[:annee]
|
||||
}
|
||||
else
|
||||
{}
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe ApiEntreprise::EffectifsJob, type: :job do
|
|||
let(:procedure_id) { procedure.id }
|
||||
let(:now) { Time.zone.local(2020, 3, 12) }
|
||||
let(:annee) { "2020" }
|
||||
let(:mois) { "02" }
|
||||
let(:mois) { "04" }
|
||||
let(:body) { File.read('spec/fixtures/files/api_entreprise/effectifs.json') }
|
||||
let(:status) { 200 }
|
||||
|
||||
|
|
Loading…
Reference in a new issue