Merge pull request #7861 from mfo/US/cleanup-procedure-dead-col

chore(clean) : drop useless procedures.direction
This commit is contained in:
mfo 2022-10-07 19:04:08 +02:00 committed by GitHub
commit d9e2c89c2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 14 deletions

View file

@ -19,7 +19,6 @@ class ProcedureDashboard < Administrate::BaseDashboard
zone: Field::BelongsTo,
lien_site_web: Field::String, # TODO: use Field::Url when administrate-v0.12 will be released
organisation: Field::String,
direction: Field::String,
created_at: Field::DateTime,
updated_at: Field::DateTime,
for_individual: Field::Boolean,
@ -67,7 +66,6 @@ class ProcedureDashboard < Administrate::BaseDashboard
:description,
:lien_site_web,
:organisation,
:direction,
:zone,
:service,
:created_at,

View file

@ -62,7 +62,7 @@ class Procedure < ApplicationRecord
include Discard::Model
self.discard_column = :hidden_at
self.ignored_columns = [:durees_conservation_required, :cerfa_flag, :test_started_at]
self.ignored_columns = [:direction, :durees_conservation_required, :cerfa_flag, :test_started_at]
default_scope -> { kept }

View file

@ -6,12 +6,12 @@ class ProcedureSerializer < ActiveModel::Serializer
attributes :id,
:description,
:organisation,
:direction,
:archived_at,
:geographic_information,
:total_dossier,
:link,
:state
:state,
:direction
has_one :geographic_information, serializer: ModuleAPICartoSerializer
has_many :types_de_champ, serializer: TypeDeChampSerializer
@ -19,6 +19,10 @@ class ProcedureSerializer < ActiveModel::Serializer
has_many :types_de_piece_justificative
belongs_to :service, serializer: ServiceSerializer
def direction
""
end
def archived_at
object.closed_at&.in_time_zone('UTC')
end

View file

@ -6,7 +6,6 @@ describe Administrateurs::ProceduresController, type: :controller do
let(:libelle) { 'Démarche de test' }
let(:description) { 'Description de test' }
let(:organisation) { 'Organisation de test' }
let(:direction) { 'Direction de test' }
let(:ministere) { create(:zone) }
let(:cadre_juridique) { 'cadre juridique' }
let(:duree_conservation_dossiers_dans_ds) { 3 }
@ -52,7 +51,6 @@ describe Administrateurs::ProceduresController, type: :controller do
libelle: libelle,
description: description,
organisation: organisation,
direction: direction,
ministere: ministere,
cadre_juridique: cadre_juridique,
duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds,
@ -206,7 +204,6 @@ describe Administrateurs::ProceduresController, type: :controller do
it { expect(subject.libelle).to eq(libelle) }
it { expect(subject.description).to eq(description) }
it { expect(subject.organisation).to eq(organisation) }
it { expect(subject.direction).to eq(direction) }
it { expect(subject.administrateurs).to eq([admin]) }
it { expect(subject.duree_conservation_dossiers_dans_ds).to eq(duree_conservation_dossiers_dans_ds) }
end
@ -276,7 +273,6 @@ describe Administrateurs::ProceduresController, type: :controller do
let(:libelle) { 'Blable' }
let(:description) { 'blabla' }
let(:organisation) { 'plop' }
let(:direction) { 'plap' }
let(:duree_conservation_dossiers_dans_ds) { 7 }
let(:procedure_expires_when_termine_enabled) { true }
@ -288,7 +284,6 @@ describe Administrateurs::ProceduresController, type: :controller do
it { expect(subject.libelle).to eq(libelle) }
it { expect(subject.description).to eq(description) }
it { expect(subject.organisation).to eq(organisation) }
it { expect(subject.direction).to eq(direction) }
it { expect(subject.duree_conservation_dossiers_dans_ds).to eq(duree_conservation_dossiers_dans_ds) }
it { expect(subject.procedure_expires_when_termine_enabled).to eq(true) }
end
@ -330,8 +325,6 @@ describe Administrateurs::ProceduresController, type: :controller do
it { expect(subject.libelle).to eq procedure_params[:libelle] }
it { expect(subject.description).to eq procedure_params[:description] }
it { expect(subject.organisation).to eq procedure_params[:organisation] }
it { expect(subject.direction).to eq procedure_params[:direction] }
it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] }
end
end

View file

@ -34,8 +34,8 @@ describe API::V1::ProceduresController, type: :controller do
it { expect(subject[:label]).to eq(procedure.libelle) }
it { expect(subject[:description]).to eq(procedure.description) }
it { expect(subject[:organisation]).to eq(procedure.organisation) }
it { expect(subject[:direction]).to eq(procedure.direction) }
it { expect(subject[:archived_at]).to eq(procedure.closed_at) }
it { expect(subject[:direction]).to eq("") }
it { expect(subject[:total_dossier]).to eq(procedure.total_dossier) }
it { is_expected.to have_key(:types_de_champ) }
it { expect(subject[:types_de_champ]).to be_an(Array) }

View file

@ -5,7 +5,6 @@ FactoryBot.define do
sequence(:libelle) { |n| "Procedure #{n}" }
description { "Demande de subvention à l'intention des associations" }
organisation { "Orga DINUM" }
direction { "direction DINUM" }
cadre_juridique { "un cadre juridique important" }
published_at { nil }
duree_conservation_dossiers_dans_ds { 3 }