commit
75c8c7c0b3
10 changed files with 29 additions and 36 deletions
|
@ -32,13 +32,9 @@ class SIADE::EtablissementAdapter
|
|||
end
|
||||
|
||||
def adresse
|
||||
adresse = ''
|
||||
[:l1, :l2, :l3, :l4, :l5, :l6, :l7].each do |line|
|
||||
if data_source[:etablissement][:adresse][line].present?
|
||||
adresse = adresse + data_source[:etablissement][:adresse][line] + "\r\n"
|
||||
end
|
||||
end
|
||||
adresse
|
||||
[:l1, :l2, :l3, :l4, :l5, :l6, :l7].map do |line|
|
||||
data_source[:etablissement][:adresse][line]
|
||||
end.compact.join("\r\n")
|
||||
end
|
||||
|
||||
def address_attribut_to_fetch
|
||||
|
|
|
@ -14,7 +14,7 @@ class Commentaire < ActiveRecord::Base
|
|||
after_create :notify
|
||||
|
||||
def header
|
||||
"#{email}, " + I18n.l(created_at.localtime, format: '%d %b %Y %H:%M')
|
||||
"#{email}, #{I18n.l(created_at.localtime, format: '%d %b %Y %H:%M')}"
|
||||
end
|
||||
|
||||
def file_url
|
||||
|
|
|
@ -154,12 +154,9 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def convert_specific_hash_values_to_string(hash_to_convert)
|
||||
hash = {}
|
||||
hash_to_convert.each do |key, value|
|
||||
value = serialize_value_for_export(value)
|
||||
hash.store(key, value)
|
||||
hash_to_convert.transform_values do |value|
|
||||
serialize_value_for_export(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
def full_data_strings_array
|
||||
|
@ -170,11 +167,11 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
def export_entreprise_data
|
||||
if entreprise.present?
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.transform_keys { |k| "etablissement.#{k}".parameterize.underscore.to_sym }
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.transform_keys { |k| "entreprise.#{k}".parameterize.underscore.to_sym }
|
||||
else
|
||||
etablissement_attr = EtablissementSerializer.new(Etablissement.new).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(Entreprise.new).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
etablissement_attr = EtablissementSerializer.new(Etablissement.new).attributes.transform_keys { |k| "etablissement.#{k}".parameterize.underscore.to_sym }
|
||||
entreprise_attr = EntrepriseSerializer.new(Entreprise.new).attributes.transform_keys { |k| "entreprise.#{k}".parameterize.underscore.to_sym }
|
||||
end
|
||||
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
||||
end
|
||||
|
|
|
@ -55,8 +55,8 @@ class Gestionnaire < ActiveRecord::Base
|
|||
procedure_ids = followed_dossiers.pluck(:procedure_id)
|
||||
|
||||
if procedure_ids.include?(procedure.id)
|
||||
return followed_dossiers.where(procedure_id: procedure.id).inject(0) do |acc, dossier|
|
||||
acc += dossier.notifications.where(already_read: false).count
|
||||
return followed_dossiers.where(procedure_id: procedure.id).sum do |dossier|
|
||||
dossier.notifications.where(already_read: false).count
|
||||
end
|
||||
end
|
||||
0
|
||||
|
|
|
@ -23,11 +23,11 @@ class RenderPartialService
|
|||
private
|
||||
|
||||
def retrieve_navbar
|
||||
'layouts/navbars/navbar_' + retrieve_name
|
||||
"layouts/navbars/navbar_#{retrieve_name}"
|
||||
end
|
||||
|
||||
def retrieve_left_panel
|
||||
'layouts/left_panels/left_panel_' + retrieve_name
|
||||
"layouts/left_panels/left_panel_#{retrieve_name}"
|
||||
end
|
||||
|
||||
def retrieve_name
|
||||
|
|
|
@ -302,8 +302,8 @@ shared_examples 'description_controller_spec' do
|
|||
before do
|
||||
post :update, params: {
|
||||
dossier_id: dossier_id,
|
||||
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
|
||||
"piece_justificative_#{all_pj_type[0].to_s}" => piece_justificative_0,
|
||||
"piece_justificative_#{all_pj_type[1].to_s}" => piece_justificative_1
|
||||
}
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -314,8 +314,8 @@ shared_examples 'description_controller_spec' do
|
|||
|
||||
post :update, params: {
|
||||
dossier_id: dossier_id,
|
||||
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
|
||||
"piece_justificative_#{all_pj_type[0].to_s}" => piece_justificative_0,
|
||||
"piece_justificative_#{all_pj_type[1].to_s}" => piece_justificative_1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -355,8 +355,8 @@ shared_examples 'description_controller_spec' do
|
|||
subject {
|
||||
patch :pieces_justificatives, params: {
|
||||
dossier_id: dossier.id,
|
||||
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
|
||||
"piece_justificative_#{all_pj_type[0].to_s}" => piece_justificative_0,
|
||||
"piece_justificative_#{all_pj_type[1].to_s}" => piece_justificative_1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,8 +434,8 @@ shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner
|
|||
subject {
|
||||
patch :pieces_justificatives, params: {
|
||||
dossier_id: dossier.id,
|
||||
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
|
||||
"piece_justificative_#{all_pj_type[0].to_s}" => piece_justificative_0,
|
||||
"piece_justificative_#{all_pj_type[1].to_s}" => piece_justificative_1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ feature 'user is on description page' do
|
|||
end
|
||||
context 'when he adds a piece_justificative and submit form', vcr: { cassette_name: 'description_page_upload_piece_justificative_adds_cerfa_and_submit' } do
|
||||
before do
|
||||
file_input_id = 'piece_justificative_' + dossier.types_de_piece_justificative.first.id.to_s
|
||||
file_input_id = "piece_justificative_#{dossier.types_de_piece_justificative.first.id.to_s}"
|
||||
attach_file(file_input_id, File.path('spec/support/files/dossierPDF.pdf'))
|
||||
click_on('Soumettre mon dossier')
|
||||
dossier.reload
|
||||
|
|
|
@ -21,7 +21,7 @@ feature 'As a User I want to edit a dossier I own' do
|
|||
end
|
||||
|
||||
scenario 'Getting a dossier, I want to create a new message on', js: true do
|
||||
page.find_by_id('tr_dossier_' + dossier.id.to_s).click
|
||||
page.find_by_id("tr_dossier_#{dossier.id.to_s}").click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s))
|
||||
page.find_by_id('open-message').click
|
||||
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
|
||||
|
@ -30,7 +30,7 @@ feature 'As a User I want to edit a dossier I own' do
|
|||
end
|
||||
|
||||
scenario 'On the same dossier, I want to edit informations', js: true do
|
||||
page.find_by_id('tr_dossier_' + dossier.id.to_s).click
|
||||
page.find_by_id("tr_dossier_#{dossier.id.to_s}").click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s))
|
||||
|
||||
# Linked Dossier
|
||||
|
|
|
@ -33,7 +33,7 @@ describe SIADE::EtablissementAdapter do
|
|||
|
||||
context 'Concaténation lignes adresse' do
|
||||
it 'L\'entreprise contient bien une adresse sur plusieurs lignes' do
|
||||
expect(subject[:adresse]).to eq("OCTO TECHNOLOGY\r\n50 AVENUE DES CHAMPS ELYSEES\r\n75008 PARIS\r\nFRANCE\r\n")
|
||||
expect(subject[:adresse]).to eq("OCTO TECHNOLOGY\r\n50 AVENUE DES CHAMPS ELYSEES\r\n75008 PARIS\r\nFRANCE")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ describe Gestionnaire, type: :model do
|
|||
it { is_expected.to eq 0 }
|
||||
it { expect(gestionnaire.follows.count).to eq 0 }
|
||||
it do
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:sum)
|
||||
subject
|
||||
end
|
||||
end
|
||||
|
@ -108,7 +108,7 @@ describe Gestionnaire, type: :model do
|
|||
it { is_expected.to eq 0 }
|
||||
it { expect(gestionnaire.follows.count).to eq 1 }
|
||||
it do
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:sum)
|
||||
subject
|
||||
end
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ describe Gestionnaire, type: :model do
|
|||
it { is_expected.to eq 1 }
|
||||
it { expect(gestionnaire.follows.count).to eq 1 }
|
||||
it do
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:inject)
|
||||
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:sum)
|
||||
subject
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue