add opendata boolean attribute for procedure
when opendata is set to true, it means that descriptive's procedure can be public when opendata is set to false, ti means that descriptive's can not be public, because the procedure is only available for public servants, not citizens.
This commit is contained in:
parent
b35aeb778a
commit
ea59f5f260
5 changed files with 31 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
|||
# lien_notice :string
|
||||
# lien_site_web :string
|
||||
# monavis_embed :text
|
||||
# opendata :boolean default(TRUE)
|
||||
# organisation :string
|
||||
# path :string not null
|
||||
# procedure_expires_when_termine_enabled :boolean default(TRUE)
|
||||
|
|
10
db/migrate/20220622181047_add_opendata_to_procedures.rb
Normal file
10
db/migrate/20220622181047_add_opendata_to_procedures.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class AddOpendataToProcedures < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
add_column :procedures, :opendata, :boolean
|
||||
change_column_default :procedures, :opendata, true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :procedures, :opendata
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class BackfillAddOpendataToProcedures < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
Procedure.in_batches do |relation|
|
||||
relation.update_all opendata: true
|
||||
sleep(0.01)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_06_21_160241) do
|
||||
ActiveRecord::Schema.define(version: 2022_06_22_183305) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
|
@ -651,6 +651,7 @@ ActiveRecord::Schema.define(version: 2022_06_21_160241) do
|
|||
t.string "lien_notice"
|
||||
t.string "lien_site_web"
|
||||
t.text "monavis_embed"
|
||||
t.boolean "opendata", default: true
|
||||
t.string "organisation"
|
||||
t.bigint "parent_procedure_id"
|
||||
t.string "path", null: false
|
||||
|
|
|
@ -381,6 +381,14 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'opendata' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
it 'is true by default' do
|
||||
expect(procedure.opendata).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe 'active' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
subject { Procedure.active(procedure.id) }
|
||||
|
|
Loading…
Reference in a new issue