diff --git a/app/models/champs/repetition_champ.rb b/app/models/champs/repetition_champ.rb index 0e9e8ef64..185aaa258 100644 --- a/app/models/champs/repetition_champ.rb +++ b/app/models/champs/repetition_champ.rb @@ -23,6 +23,14 @@ class Champs::RepetitionChamp < Champ rows.last&.first&.focusable_input_id end + def discarded? + discarded_at.present? + end + + def discard! + touch(:discarded_at) + end + def search_terms # The user cannot enter any information here so it doesn’t make much sense to search end diff --git a/db/migrate/20241007174301_add_discarded_at_to_champs.rb b/db/migrate/20241007174301_add_discarded_at_to_champs.rb new file mode 100644 index 000000000..c25e4c585 --- /dev/null +++ b/db/migrate/20241007174301_add_discarded_at_to_champs.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDiscardedAtToChamps < ActiveRecord::Migration[7.0] + def change + add_column :champs, :discarded_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 756cedcaf..e0bd12e54 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -250,6 +250,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_26_145420) do create_table "champs", id: :serial, force: :cascade do |t| t.datetime "created_at", precision: nil t.jsonb "data" + t.datetime "discarded_at" t.integer "dossier_id" t.integer "etablissement_id" t.string "external_id"