feat(sva): date in pdf
This commit is contained in:
parent
8c49dcf21e
commit
4c46a2f8da
3 changed files with 22 additions and 0 deletions
|
@ -1283,6 +1283,10 @@ class Dossier < ApplicationRecord
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sva_svr_decision_in_days
|
||||||
|
(sva_svr_decision_on - Date.current).to_i
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_missing_traitemets
|
def create_missing_traitemets
|
||||||
|
|
|
@ -241,6 +241,18 @@ def add_etats_dossier(pdf, dossier)
|
||||||
format_in_2_columns(pdf, "En instruction le", try_format_date(dossier.en_instruction_at))
|
format_in_2_columns(pdf, "En instruction le", try_format_date(dossier.en_instruction_at))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if dossier.sva_svr_decision_triggered_at.present?
|
||||||
|
format_in_2_columns(pdf, "Décision #{dossier.procedure.sva_svr_configuration.human_decision} prise le", try_format_date(dossier.sva_svr_decision_triggered_at))
|
||||||
|
elsif dossier.sva_svr_decision_on.present?
|
||||||
|
value = if dossier.pending_correction?
|
||||||
|
"#{dossier.sva_svr_decision_in_days} jours après la correction"
|
||||||
|
else
|
||||||
|
try_format_date(dossier.sva_svr_decision_on)
|
||||||
|
end
|
||||||
|
|
||||||
|
format_in_2_columns(pdf, "Date prévisionnelle #{dossier.procedure.sva_svr_configuration.human_decision}", value)
|
||||||
|
end
|
||||||
|
|
||||||
if dossier.processed_at.present?
|
if dossier.processed_at.present?
|
||||||
format_in_2_columns(pdf, "Décision le", try_format_date(dossier.processed_at))
|
format_in_2_columns(pdf, "Décision le", try_format_date(dossier.processed_at))
|
||||||
end
|
end
|
||||||
|
|
|
@ -2043,6 +2043,12 @@ describe Dossier, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#sva_svr_decision_in_days' do
|
||||||
|
let(:dossier) { create(:dossier, :en_instruction, sva_svr_decision_on: 10.days.from_now) }
|
||||||
|
|
||||||
|
it { expect(dossier.sva_svr_decision_in_days).to eq 10 }
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def count_for_month(processed_by_month, month)
|
def count_for_month(processed_by_month, month)
|
||||||
|
|
Loading…
Add table
Reference in a new issue