Enable the Layout/MultilineMethodCallIndentation cop
This commit is contained in:
parent
b77837bfd1
commit
73dd58b6cd
21 changed files with 85 additions and 85 deletions
|
@ -240,12 +240,12 @@ module NewGestionnaire
|
|||
when 'user', 'etablissement', 'entreprise'
|
||||
if filter['column'] == 'date_creation'
|
||||
dossiers
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} = ?", filter['value'].to_date)
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} = ?", filter['value'].to_date)
|
||||
else
|
||||
dossiers
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||
end
|
||||
|
||||
end.pluck(:id)
|
||||
|
|
|
@ -54,8 +54,7 @@ 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|
|
||||
return followed_dossiers.where(procedure_id: procedure.id).inject(0) do |acc, dossier|
|
||||
acc += dossier.notifications.where(already_read: false).count
|
||||
end
|
||||
end
|
||||
|
@ -83,9 +82,9 @@ class Gestionnaire < ActiveRecord::Base
|
|||
start_date = DateTime.now.beginning_of_week
|
||||
|
||||
active_procedure_overviews = procedures
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date) }
|
||||
.select(&:had_some_activities?)
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date) }
|
||||
.select(&:had_some_activities?)
|
||||
|
||||
if active_procedure_overviews.count == 0
|
||||
nil
|
||||
|
@ -124,8 +123,8 @@ class Gestionnaire < ActiveRecord::Base
|
|||
|
||||
messagerie = follow.messagerie_seen_at.present? &&
|
||||
dossier.commentaires
|
||||
.where.not(email: 'contact@tps.apientreprise.fr')
|
||||
.updated_since?(follow.messagerie_seen_at).any?
|
||||
.where.not(email: 'contact@tps.apientreprise.fr')
|
||||
.updated_since?(follow.messagerie_seen_at).any?
|
||||
|
||||
annotations_hash(demande, annotations_privees, avis_notif, messagerie)
|
||||
else
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
class PiecesJustificativesService
|
||||
def self.upload!(dossier, user, params)
|
||||
tpj_contents = dossier.types_de_piece_justificative
|
||||
.map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] }
|
||||
.select { |_, content| content.present? }
|
||||
.map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] }
|
||||
.select { |_, content| content.present? }
|
||||
|
||||
without_virus, with_virus = tpj_contents
|
||||
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
||||
.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) }
|
||||
.compact()
|
||||
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
||||
.compact()
|
||||
end
|
||||
|
||||
def self.upload_one! dossier, user, params
|
||||
content = params[:piece_justificative][:content]
|
||||
if ClamavService.safe_file? content.path
|
||||
pj = PieceJustificative.new(content: content,
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: nil,
|
||||
user: user)
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: nil,
|
||||
user: user)
|
||||
|
||||
pj.save
|
||||
else
|
||||
|
@ -34,9 +34,9 @@ class PiecesJustificativesService
|
|||
|
||||
def self.save_pj(content, dossier, tpj, user)
|
||||
pj = PieceJustificative.new(content: content,
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: tpj,
|
||||
user: user)
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: tpj,
|
||||
user: user)
|
||||
|
||||
pj.save ? nil : "le fichier #{content.original_filename} (#{pj.libelle.truncate(200)}) n'a pas pu être sauvegardé"
|
||||
end
|
||||
|
|
|
@ -5,17 +5,17 @@ class TypesDeChampService
|
|||
params_with_ordered_champs = order_champs(params, attributes)
|
||||
|
||||
parameters = params_with_ordered_champs
|
||||
.require(:procedure)
|
||||
.permit("#{attributes}" => [
|
||||
:libelle,
|
||||
:description,
|
||||
:order_place,
|
||||
:type_champ,
|
||||
:id,
|
||||
:mandatory,
|
||||
:type,
|
||||
drop_down_list_attributes: [:value, :id]
|
||||
])
|
||||
.require(:procedure)
|
||||
.permit("#{attributes}" => [
|
||||
:libelle,
|
||||
:description,
|
||||
:order_place,
|
||||
:type_champ,
|
||||
:id,
|
||||
:mandatory,
|
||||
:type,
|
||||
drop_down_list_attributes: [:value, :id]
|
||||
])
|
||||
|
||||
parameters[attributes].each do |param_first, param_second|
|
||||
if param_second[:libelle].empty?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue