Skip to content

Commit

Permalink
Merge pull request #2875 from sanger/develop
Browse files Browse the repository at this point in the history
Develop into master
  • Loading branch information
stevieing authored Aug 12, 2020
2 parents 57714e2 + 8d3fca6 commit 440cd8e
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 22 deletions.
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ GEM
backports (3.18.1)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.4.6)
bootsnap (1.4.7)
msgpack (~> 1.0)
bootstrap (4.5.0)
autoprefixer-rails (>= 9.1.0)
Expand Down Expand Up @@ -163,11 +163,11 @@ GEM
cucumber-messages (~> 12.2, >= 12.2.0)
sys-uname (~> 1.2, >= 1.2.1)
cucumber-cucumber-expressions (10.2.1)
cucumber-gherkin (14.0.1)
cucumber-messages (~> 12.2, >= 12.2.0)
cucumber-gherkin (14.1.0)
cucumber-messages (~> 12.3, >= 12.3.2)
cucumber-html-formatter (7.0.0)
cucumber-messages (~> 12.2, >= 12.2.0)
cucumber-messages (12.2.0)
cucumber-messages (12.3.2)
protobuf-cucumber (~> 3.10, >= 3.10.8)
cucumber-rails (2.1.0)
capybara (>= 2.12, < 4)
Expand Down Expand Up @@ -240,7 +240,7 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.8.3)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
Expand All @@ -259,7 +259,7 @@ GEM
rake
launchy (2.5.0)
addressable (~> 2.7)
libv8 (7.3.492.27.1)
libv8 (8.4.255.0)
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand All @@ -275,8 +275,8 @@ GEM
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
mini_racer (0.2.15)
libv8 (> 7.3)
mini_racer (0.3.1)
libv8 (~> 8.4.255)
minitest (5.10.3)
minitest-profiler (0.0.2)
activesupport (>= 4.1.0)
Expand Down Expand Up @@ -327,7 +327,7 @@ GEM
rack (>= 1.1.0)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-mini-profiler (2.0.2)
rack-mini-profiler (2.0.3)
rack (>= 1.2.0)
rack-protection (2.0.8.1)
rack
Expand Down Expand Up @@ -422,14 +422,14 @@ GEM
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.1.0)
rubocop-ast (0.2.0)
parser (>= 2.7.0.1)
rubocop-performance (1.7.1)
rubocop (>= 0.82.0)
rubocop-rails (2.6.0)
rubocop-rails (2.7.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.82.0)
rubocop (>= 0.87.0)
rubocop-rspec (1.42.0)
rubocop (>= 0.87.0)
ruby-graphviz (1.2.5)
Expand Down
31 changes: 30 additions & 1 deletion app/uat_actions/uat_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ class UatActions
self.message = 'Completed successfully'

class << self
#
# Returns a list of all registered UatActions
#
# @return [Array<UatAction>] All registered UatActions
#
def all
uat_actions.values
end

#
# Find the UatAction identified by the id (Usually the class name parameterized)
#
# @param [String] id The id of the UatAction to find.
#
# @return [Class] A UatAction class
#
def find(id)
uat_actions[id]
end
Expand All @@ -27,7 +39,9 @@ def uat_actions
@uat_actions ||= {}
end

# Called by UatActions classes to register themselves
# Automatically called by UatActions classes to register themselves
#
# @param [Class] other Automatically called when inherited. Receives the descendant class
def inherited(other)
# Register the form_fields of the parent class
other.form_fields.concat(form_fields)
Expand All @@ -42,6 +56,21 @@ def id
name.demodulize.parameterize
end

#
# Register a new {UatActions::FormField}. This will be automatically rendered by the UI
# and any attributes will be available and instance attributes.
#
# @param [Symbol] attribute The attribute the field is linked to.
# @param [Symbol] type The type of field to render. Should be something {ActionView::Helpers::FormBuilder}
# responds to. @see https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html
# @param [Hash] options Configure the attributes
# @option options [String] :label The human readable label for the attribute, determines the field label
# @option options [String] :help More verbose help text to explain the field (shown to the user)
# @option options [Hash] :options Additional options passed through to the {ActionView::Helpers::FormBuilder} field
# itself. Eg. required, max, min, include_blank
#
# @return [void]
#
def form_field(attribute, type, options = {})
@form_fields ||= []
attr_accessor attribute
Expand Down
11 changes: 8 additions & 3 deletions app/uat_actions/uat_actions/generate_tagged_plates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Will construct plates with well_count wells filled with samples
class UatActions::GenerateTaggedPlates < UatActions::GeneratePlates
# These walking algortihms have dependencies on submission and do
# These walking algorithms have dependencies on submission and do
# not make sense here.
EXCLUDED_WALKING = ['wells in pools', 'manual by pool'].freeze

Expand All @@ -23,7 +23,8 @@ class UatActions::GenerateTaggedPlates < UatActions::GeneratePlates
label: 'i5 (tag2) Tag group',
help: 'Select the tag group to use for the i7 tag. '\
'Set to \'Untagged\' for single indexed samples.',
select_options: -> { TagGroup.visible.alphabetical.pluck(:name) }
select_options: -> { TagGroup.visible.alphabetical.pluck(:name) },
options: { include_blank: 'Untagged' }
form_field :direction,
:select,
label: 'Tag direction',
Expand All @@ -45,7 +46,7 @@ class UatActions::GenerateTaggedPlates < UatActions::GeneratePlates
validates :walking_by, inclusion: { in: TagLayout::WALKING_ALGORITHMS.keys - EXCLUDED_WALKING }, presence: true
validates :tag_group_name, presence: true
validates :tag_group, presence: { message: 'could not be found' }, if: :tag_group_name
validates :tag2_group, presence: { message: 'could not be found' }, if: :tag2_group_name
validates :tag2_group, presence: { message: 'could not be found' }, if: :tag2_group_name?

def self.default
new(
Expand Down Expand Up @@ -74,6 +75,10 @@ def perform

private

def tag2_group_name?
tag2_group_name.present?
end

def user
UatActions::StaticRecords.user
end
Expand Down
2 changes: 1 addition & 1 deletion lib/label_printer/label_printer/label/base_tube.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def round_label_bottom_line(tube)
end

def barcode(tube)
tube.ean13_barcode
tube.machine_barcode
end

def tubes
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/label_printer/asset_labels_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
bottom_line: date,
round_label_top_line: asset.prefix,
round_label_bottom_line: asset.barcode_number,
barcode: asset.machine_barcode.to_s } }
barcode: asset.machine_barcode } }
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/lib/label_printer/batch_multiplex_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def setup
bottom_line: (Date.today.strftime('%e-%^b-%Y')).to_s,
round_label_top_line: prefix,
round_label_bottom_line: barcode1,
barcode: tube1.ean13_barcode }
barcode: tube1.machine_barcode }
end

test 'should return correct tubes' do
Expand Down
2 changes: 1 addition & 1 deletion test/lib/label_printer/plate_to_tube_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setup
bottom_line: (Date.today.strftime('%e-%^b-%Y')).to_s,
round_label_top_line: prefix,
round_label_bottom_line: barcode1,
barcode: tube1.ean13_barcode }
barcode: tube1.machine_barcode }
end

test 'should have tubes' do
Expand Down
2 changes: 1 addition & 1 deletion test/lib/label_printer/sample_manifest_multiplex_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setup
bottom_line: (Date.today.strftime('%e-%^b-%Y')).to_s,
round_label_top_line: prefix,
round_label_bottom_line: barcode1,
barcode: tube1.ean13_barcode }
barcode: tube1.machine_barcode }
end

test 'should return correct tubes' do
Expand Down
2 changes: 1 addition & 1 deletion test/lib/label_printer/sample_manifest_tube_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setup
bottom_line: (Date.today.strftime('%e-%^b-%Y')).to_s,
round_label_top_line: prefix,
round_label_bottom_line: barcode1,
barcode: tube1.ean13_barcode }
barcode: tube1.machine_barcode }
end

test 'should return the right list of tubes' do
Expand Down

0 comments on commit 440cd8e

Please sign in to comment.