Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/sample_manifest/sample_tube_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def io_samples
end

def acceptable_purposes
Tube::Purpose.where(target_type: SampleTube)
Tube::Purpose.where(target_type: SampleTube, deprecated: false)
end

def default_purpose
Expand Down
2 changes: 1 addition & 1 deletion app/models/sample_manifest/tube_rack_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def generate
end

def acceptable_purposes
Tube::Purpose.where(target_type: SampleTube)
Tube::Purpose.where(target_type: SampleTube, deprecated: false)
end

def acceptable_rack_purposes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddDeprecatedFieldsToPlatePurposes < ActiveRecord::Migration[8.0]
def change
add_column :plate_purposes, :deprecated, :boolean, default: false, null: false
add_column :plate_purposes, :deprecated_at, :datetime
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.0].define(version: 2026_04_24_000000) do
ActiveRecord::Schema[8.0].define(version: 2026_04_29_114103) do
create_table "accession_sample_statuses", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.integer "sample_id", null: false
t.string "status", null: false
Expand Down Expand Up @@ -857,6 +857,8 @@
t.integer "source_purpose_id"
t.integer "lifespan"
t.integer "barcode_prefix_id"
t.boolean "deprecated", default: false, null: false
t.datetime "deprecated_at"
t.index ["barcode_prefix_id"], name: "fk_rails_763bed2756"
t.index ["target_type"], name: "index_plate_purposes_on_target_type"
t.index ["type"], name: "index_plate_purposes_on_type"
Expand Down
20 changes: 20 additions & 0 deletions lib/tasks/deprecate_lrc_bank_input_purpose.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# # One-time task run to deprecate the LRC Bank Input tube purpose.
# # For reference: Y26-075

namespace :LRC_BANK_INPUT do
desc 'Deprecate LRC Bank Input tube purpose'
task deprecate_lrc_bank_input_purpose: :environment do
lrc_bank_input_purpose = Tube::Purpose.find_by(name: 'LRC Bank Input')

unless lrc_bank_input_purpose
puts "Tube Purpose 'LRC Bank Input' not found. No action taken."
next
end

lrc_bank_input_purpose.update!(deprecated: true, deprecated_at: DateTime.now)

puts 'Done: LRC Bank Input tube purpose is been deprecated.'
end
end
Loading