rename effectif columns
This commit is contained in:
parent
ea37d8ee0a
commit
1165f8483d
7 changed files with 19 additions and 12 deletions
|
@ -131,8 +131,8 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_format_mois_effectif(etablissement)
|
def try_format_mois_effectif(etablissement)
|
||||||
if etablissement.effectif_mois.present? && etablissement.effectif_annee.present?
|
if etablissement.entreprise_effectif_mois.present? && etablissement.entreprise_effectif_annee.present?
|
||||||
[etablissement.effectif_mois, etablissement.effectif_annee].join('/')
|
[etablissement.entreprise_effectif_mois, etablissement.entreprise_effectif_annee].join('/')
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,9 +15,9 @@ class ApiEntreprise::EffectifsAdapter < ApiEntreprise::Adapter
|
||||||
def process_params
|
def process_params
|
||||||
if data_source[:effectifs_mensuels].present?
|
if data_source[:effectifs_mensuels].present?
|
||||||
{
|
{
|
||||||
effectif_mensuel: data_source[:effectifs_mensuels],
|
entreprise_effectif_mensuel: data_source[:effectifs_mensuels],
|
||||||
effectif_mois: @mois,
|
entreprise_effectif_mois: @mois,
|
||||||
effectif_annee: @annee
|
entreprise_effectif_annee: @annee
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
|
|
7
db/migrate/20200421174642_rename_effectif_mensuel.rb
Normal file
7
db/migrate/20200421174642_rename_effectif_mensuel.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class RenameEffectifMensuel < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
rename_column :etablissements, :effectif_mensuel, :entreprise_effectif_mensuel
|
||||||
|
rename_column :etablissements, :effectif_mois, :entreprise_effectif_mois
|
||||||
|
rename_column :etablissements, :effectif_annee, :entreprise_effectif_annee
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2020_04_09_075320) do
|
ActiveRecord::Schema.define(version: 2020_04_21_174642) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -310,9 +310,9 @@ ActiveRecord::Schema.define(version: 2020_04_09_075320) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "diffusable_commercialement"
|
t.boolean "diffusable_commercialement"
|
||||||
t.string "effectif_mois"
|
t.string "entreprise_effectif_mois"
|
||||||
t.string "effectif_annee"
|
t.string "entreprise_effectif_annee"
|
||||||
t.decimal "effectif_mensuel"
|
t.decimal "entreprise_effectif_mensuel"
|
||||||
t.index ["dossier_id"], name: "index_etablissements_on_dossier_id"
|
t.index ["dossier_id"], name: "index_etablissements_on_dossier_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
expect(dossier.etablissement.entreprise).to be_present
|
expect(dossier.etablissement.entreprise).to be_present
|
||||||
expect(dossier.etablissement.exercices).to be_present
|
expect(dossier.etablissement.exercices).to be_present
|
||||||
expect(dossier.etablissement.association?).to be(true)
|
expect(dossier.etablissement.association?).to be(true)
|
||||||
expect(dossier.etablissement.effectif_mensuel).to be_present
|
expect(dossier.etablissement.entreprise_effectif_mensuel).to be_present
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe ApiEntreprise::EffectifsAdapter do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renvoie les effectifs du mois demandé" do
|
it "renvoie les effectifs du mois demandé" do
|
||||||
expect(subject[:effectif_mensuel]).to eq(100.5)
|
expect(subject[:entreprise_effectif_mensuel]).to eq(100.5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ describe ApiEntrepriseService do
|
||||||
expect(result[:siret]).to eq(siret)
|
expect(result[:siret]).to eq(siret)
|
||||||
expect(result[:association_rna]).to eq(rna)
|
expect(result[:association_rna]).to eq(rna)
|
||||||
expect(result[:exercices_attributes]).to_not be_empty
|
expect(result[:exercices_attributes]).to_not be_empty
|
||||||
expect(result[:effectif_mensuel]).to eq(effectif_mensuel)
|
expect(result[:entreprise_effectif_mensuel]).to eq(effectif_mensuel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue