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