Purge all dossier with state draft
This commit is contained in:
parent
71de64e3ec
commit
fd6b1f15a0
3 changed files with 32 additions and 2 deletions
|
@ -5,7 +5,12 @@
|
||||||
.col-md-1.col-lg-1
|
.col-md-1.col-lg-1
|
||||||
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
|
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
|
||||||
.col-md-11.col-lg-11
|
.col-md-11.col-lg-11
|
||||||
-if dossiers_list_facade.liste == 'nouveaux'
|
-if dossiers_list_facade.liste == 'brouillon'
|
||||||
|
Les dossiers présents dans cette liste
|
||||||
|
%b
|
||||||
|
n'ont pas encore été soumis à votre administrations.
|
||||||
|
Ils ne sont visible que par vous.
|
||||||
|
-elsif dossiers_list_facade.liste == 'nouveaux'
|
||||||
Les dossiers présents dans cette liste
|
Les dossiers présents dans cette liste
|
||||||
%b
|
%b
|
||||||
n'ont pas encore été ouverts
|
n'ont pas encore été ouverts
|
||||||
|
|
25
db/migrate/20161005144657_purge_draft_dossier.rb
Normal file
25
db/migrate/20161005144657_purge_draft_dossier.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
class PurgeDraftDossier < ActiveRecord::Migration
|
||||||
|
class Dossier < ActiveRecord::Base
|
||||||
|
BROUILLON = %w(draft)
|
||||||
|
|
||||||
|
def brouillon?
|
||||||
|
BROUILLON.include?(state)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Commentaire < ActiveRecord::Base
|
||||||
|
belongs_to :dossier
|
||||||
|
end
|
||||||
|
|
||||||
|
class Cerfa < ActiveRecord::Base
|
||||||
|
belongs_to :dossier
|
||||||
|
belongs_to :user
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
Cerfa.all.each { |cerfa| cerfa.delete if cerfa.dossier.brouillon? }
|
||||||
|
Commentaire.all.each { |com| com.delete if com.dossier.brouillon? }
|
||||||
|
|
||||||
|
Dossier.where(state: :draft).destroy_all
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20161005082113) do
|
ActiveRecord::Schema.define(version: 20161005144657) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
Loading…
Add table
Reference in a new issue