Skip to content

Commit

Permalink
Merge pull request #2028 from sanger/y24-099-plate-split-to-racks
Browse files Browse the repository at this point in the history
Y24-099 plate split to racks
  • Loading branch information
andrewsparkes authored Nov 27, 2024
2 parents e338692 + f4eca57 commit c2b9761
Show file tree
Hide file tree
Showing 37 changed files with 1,348 additions and 332 deletions.
2 changes: 1 addition & 1 deletion app/controllers/creation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def params_purpose_uuid
end

def parent_uuid
params[:limber_tube_id] || params[:limber_plate_id]
params[:limber_tube_id] || params[:limber_plate_id] || params[:limber_tube_rack_id]
end

def extract_error_messages_from_api_exception(api_message)
Expand Down
5 changes: 4 additions & 1 deletion app/frontend/stylesheets/limber/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ nav.robots-list {
.robots-button,
.create-plate-button,
.create-tube-button,
.create-tube_rack-button,
.csv-link,
.create-submission-button {
@extend .btn;
Expand All @@ -278,14 +279,16 @@ nav.robots-list {
.other-actions {
.work-completion-button,
.create-plate-button,
.create-tube_rack-button,
.create-tube-button {
@extend .btn-secondary;
}
}
.suggested-actions {
.work-completion-button,
.create-plate-button,
.create-tube-button {
.create-tube-button,
.create-tube_rack-button {
@extend .btn-success;
}
}
Expand Down
1 change: 1 addition & 0 deletions app/helpers/page_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def jumbotron(jumbotron_id = nil, options = {}, &)
# eg. state_badge('pending')
# <span class="state-badge-pending">Pending</span>
def state_badge(state, title: 'Labware State')
return if state.blank? # added as TubeRack has a nil state
tag.span(state.titleize, class: "state-badge #{state}", title: title, data: { toggle: 'tooltip' })
end

Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/presenters/creation_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def compatible_tube_purposes
construct_buttons(purposes_of_type('tube'))
end

def compatible_tube_rack_purposes
construct_buttons(purposes_of_type('tube_rack'))
end

private

# Eventually this will end up on our labware_creators/creations module
Expand Down
10 changes: 10 additions & 0 deletions app/models/labware_creators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,25 @@ def custom_form?

# limber_plate_children (Plate -> Plate) (plate_creation#create)
# limber_plate_tubes (Plate -> Tube) (tube_creation#create)
# limber_plate_tube_racks (Plate -> TubeRack) (tube_rack_creation#create)
# limber_tube_children (Tube -> Plate) (nothing - want to be plate_creation#create)
# limber_tube_tubes (Tube -> Tube) (tube_creation#create)
# limber_tube_tube_racks (Tube -> TubeRack) (tube_rack_creation#create)

# Returns the ActiveModel::Name instance for the given type.
# This method maps the type to the corresponding model class and returns an ActiveModel::Name instance.
#
# @return [ActiveModel::Name] the ActiveModel::Name instance for the given type.
# @raise [StandardError] if the type is unknown.
def model_name
case type
# TODO: can we rename 'child' to 'plate' please? see routes.rb
when 'plate'
::ActiveModel::Name.new(Limber::Plate, nil, 'child')
when 'tube'
::ActiveModel::Name.new(Limber::Tube, nil, 'tube')
when 'tube_rack'
::ActiveModel::Name.new(Limber::TubeRack, nil, 'tube_rack')
else
raise StandardError, "Unknown type #{type}"
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/labware_creators/donor_pooling_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def barcodes=(barcodes)
def calculated_number_of_pools
return if source_wells_for_pooling.blank?

# div enfoces integer division
# div enforces integer division
source_wells_for_pooling.count.div(number_of_samples_per_pool)
end

Expand Down
Loading

0 comments on commit c2b9761

Please sign in to comment.