sanger/limber

View on GitHub
app/models/labware_creators/tube_from_tube.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module LabwareCreators
  # For simple tube to tube transfers
  class TubeFromTube < Base
    include SupportParent::TubeOnly

    self.default_transfer_template_name = 'Transfer between specific tubes'

    attr_reader :tube_transfer

    def create_labware!
      @child_tube =
        api.tube_from_tube_creation.create!(parent: parent_uuid, child_purpose: purpose_uuid, user: user_uuid).child

      @tube_transfer = transfer!(source_uuid: parent_uuid, destination_uuid: @child_tube.uuid)

      true
    end

    # We pretend that we've added a new blank tube when we're actually
    # transfering to the tube on the original LibraryRequest
    def redirection_target
      @child_tube
    end
  end
end