Merge pull request #5246 from betagouv/effectifs_avril

ask only effectifs for april
This commit is contained in:
krichtof 2020-06-10 17:50:05 +02:00 committed by GitHub
commit b264839039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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
{}

View file

@ -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 }