commit
a709bd3fb3
14 changed files with 24 additions and 24 deletions
|
@ -2,7 +2,7 @@ class EntrepriseDecorator < Draper::Decorator
|
|||
delegate_all
|
||||
|
||||
def raison_sociale_or_name
|
||||
raison_sociale.blank? ? nom + ' ' + prenom : raison_sociale
|
||||
raison_sociale.blank? ? "#{nom} #{prenom}" : raison_sociale
|
||||
end
|
||||
|
||||
def effectif
|
||||
|
|
|
@ -9,7 +9,7 @@ class FindDubiousProceduresJob < ApplicationJob
|
|||
def perform(*args)
|
||||
# \\y is a word boundary
|
||||
forbidden_regexp = FORBIDDEN_KEYWORDS
|
||||
.map { |keyword| '\\y' + keyword + '\\y' }
|
||||
.map { |keyword| "\\y#{keyword}\\y" }
|
||||
.join('|')
|
||||
|
||||
# ~* -> case insensitive regexp match
|
||||
|
|
|
@ -25,8 +25,8 @@ module Carto
|
|||
return []
|
||||
end
|
||||
|
||||
result['features'].inject([]) do |acc, feature|
|
||||
acc.push feature['properties']['label']
|
||||
result['features'].map do |feature|
|
||||
feature['properties']['label']
|
||||
end
|
||||
rescue TypeError, JSON::ParserError
|
||||
[]
|
||||
|
|
|
@ -8,11 +8,11 @@ class CARTO::SGMAP::Cadastre::Adapter
|
|||
end
|
||||
|
||||
def to_params
|
||||
data_source[:features].inject([]) do |acc, feature|
|
||||
data_source[:features].map do |feature|
|
||||
tmp = filter_properties feature[:properties]
|
||||
tmp[:geometry] = feature[:geometry]
|
||||
|
||||
acc << tmp
|
||||
tmp
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -48,15 +48,15 @@ class Champ < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.regions
|
||||
JSON.parse(Carto::GeoAPI::Driver.regions).sort_by { |e| e['nom'] }.inject([]) { |acc, liste| acc.push(liste['nom']) }
|
||||
JSON.parse(Carto::GeoAPI::Driver.regions).sort_by { |e| e['nom'] }.pluck("nom")
|
||||
end
|
||||
|
||||
def self.departements
|
||||
JSON.parse(Carto::GeoAPI::Driver.departements).inject([]) { |acc, liste| acc.push(liste['code'] + ' - ' + liste['nom']) }.push('99 - Étranger')
|
||||
JSON.parse(Carto::GeoAPI::Driver.departements).map { |liste| "#{liste['code']} - #{liste['nom']}" }.push('99 - Étranger')
|
||||
end
|
||||
|
||||
def self.pays
|
||||
JSON.parse(Carto::GeoAPI::Driver.pays).inject([]) { |acc, liste| acc.push(liste['nom']) }
|
||||
JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom")
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -217,6 +217,6 @@ class Gestionnaire < ActiveRecord::Base
|
|||
updated_annotations,
|
||||
updated_avis,
|
||||
updated_messagerie
|
||||
].map { |query| query.distinct.ids }.flatten.uniq
|
||||
].flat_map { |query| query.distinct.ids }.uniq
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,10 +32,10 @@ class ModuleApiCartoService
|
|||
end
|
||||
|
||||
def self.generate_cadastre coordinates
|
||||
(coordinates.inject([]) { |acc, coordinate|
|
||||
acc << CARTO::SGMAP::Cadastre::Adapter.new(
|
||||
coordinates.flat_map do |coordinate|
|
||||
CARTO::SGMAP::Cadastre::Adapter.new(
|
||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||
).to_params
|
||||
}).flatten
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class PiecesJustificativesService
|
|||
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
||||
|
||||
errors = with_virus
|
||||
.map { |_, content| content.original_filename + ' : virus détecté' }
|
||||
.map { |_, content| "#{content.original_filename} : virus détecté" }
|
||||
|
||||
errors += without_virus
|
||||
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
||||
|
@ -26,7 +26,7 @@ class PiecesJustificativesService
|
|||
pj.save
|
||||
else
|
||||
pj = PieceJustificative.new
|
||||
pj.errors.add(:content, content.original_filename + ': <b>Virus détecté !!</b>')
|
||||
pj.errors.add(:content, "#{content.original_filename} : <b>Virus détecté !!</b>")
|
||||
end
|
||||
|
||||
pj
|
||||
|
|
|
@ -17,7 +17,7 @@ class RenderPartialService
|
|||
def self.left_panel_exist? left_panel_url
|
||||
file = left_panel_url.split('/').last
|
||||
|
||||
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', '_' + file + '.html.haml'))
|
||||
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', "_#{file}.html.haml"))
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -31,6 +31,6 @@ class RenderPartialService
|
|||
end
|
||||
|
||||
def retrieve_name
|
||||
controller.to_s.parameterize.underscore + '_' + method.to_s
|
||||
"#{controller.to_s.parameterize.underscore}_#{method.to_s}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,8 +8,8 @@ require 'yaml'
|
|||
# ansible config
|
||||
class Features
|
||||
class << self
|
||||
if File.exist?(File.dirname(__FILE__) + '/features.yml')
|
||||
features_map = YAML.load_file(File.dirname(__FILE__) + '/features.yml')
|
||||
if File.exist?("#{File.dirname(__FILE__)}/features.yml")
|
||||
features_map = YAML.load_file("#{File.dirname(__FILE__)}/features.yml")
|
||||
if features_map
|
||||
features_map.each do |feature, is_active|
|
||||
define_method("#{feature}") do
|
||||
|
|
|
@ -1 +1 @@
|
|||
STORAGE_URL = "https://storage.apientreprise.fr/" + CarrierWave::Uploader::Base.fog_directory + '/'
|
||||
STORAGE_URL = "https://storage.apientreprise.fr/#{CarrierWave::Uploader::Base.fog_directory}/"
|
||||
|
|
|
@ -279,7 +279,7 @@ shared_examples 'description_controller_spec' do
|
|||
it { expect(response).to redirect_to users_dossier_recapitulatif_path }
|
||||
|
||||
context 'when champs is type_de_champ datetime' do
|
||||
it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq(dossier_date_value + ' ' + dossier_hour_value + ':' + dossier_minute_value) }
|
||||
it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq("#{dossier_date_value} #{dossier_hour_value}:#{dossier_minute_value}") }
|
||||
end
|
||||
|
||||
context 'when champs value is empty' do
|
||||
|
|
|
@ -27,7 +27,7 @@ describe EntrepriseDecorator do
|
|||
context 'when raison_sociale is nil' do
|
||||
let(:raison_sociale) { nil }
|
||||
it 'display nom and prenom' do
|
||||
expect(subject).to eq(nom + ' ' + prenom)
|
||||
expect(subject).to eq("#{nom} #{prenom}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,12 +8,12 @@ describe RenderPartialService do
|
|||
describe 'navbar' do
|
||||
subject { service.navbar }
|
||||
|
||||
it { is_expected.to eq 'layouts/navbars/navbar_' + controller.to_s.parameterize + '_' + method.to_s }
|
||||
it { is_expected.to eq "layouts/navbars/navbar_#{controller.to_s.parameterize}_#{method.to_s}" }
|
||||
end
|
||||
|
||||
describe 'left_panel' do
|
||||
subject { service.left_panel }
|
||||
|
||||
it { is_expected.to eq 'layouts/left_panels/left_panel_' + controller.to_s.parameterize + '_' + method.to_s }
|
||||
it { is_expected.to eq "layouts/left_panels/left_panel_#{controller.to_s.parameterize}_#{method.to_s}" }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue