From 628608280f04c69c110bfcca58e19de24b743a4f Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2020 13:10:40 +0000 Subject: [PATCH 1/6] Update all Bundler dependencies (2020-07-29) --- Gemfile.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca2316bbf1..39b3c65390 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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) From a4dc15e9fb2df2d83bb8327088bdb505590939c4 Mon Sep 17 00:00:00 2001 From: James Glover Date: Fri, 31 Jul 2020 08:32:06 +0100 Subject: [PATCH 2/6] Fix missing Untagged Option - Passes the include_blank option to the form element. - Update the check for tag2 group to be based on presence not truthiness - Add some docs while I'm at it. --- app/uat_actions/uat_actions.rb | 31 ++++++++++++++++++- .../uat_actions/generate_tagged_plates.rb | 11 +++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/uat_actions/uat_actions.rb b/app/uat_actions/uat_actions.rb index df3044c08d..9c3c1b7367 100644 --- a/app/uat_actions/uat_actions.rb +++ b/app/uat_actions/uat_actions.rb @@ -14,10 +14,22 @@ class UatActions self.message = 'Completed successfully' class << self + # + # Returns a list of all registered UatActions + # + # @return [Array] 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 @@ -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) @@ -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 diff --git a/app/uat_actions/uat_actions/generate_tagged_plates.rb b/app/uat_actions/uat_actions/generate_tagged_plates.rb index 301c470a35..d69860473e 100644 --- a/app/uat_actions/uat_actions/generate_tagged_plates.rb +++ b/app/uat_actions/uat_actions/generate_tagged_plates.rb @@ -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 @@ -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', @@ -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( @@ -74,6 +75,10 @@ def perform private + def tag2_group_name? + tag2_group_name.present? + end + def user UatActions::StaticRecords.user end From 57868e6dedd1c023ac5b2a0c73f2f932e119f0ef Mon Sep 17 00:00:00 2001 From: Stephen Inglis Date: Fri, 7 Aug 2020 08:59:41 +0100 Subject: [PATCH 3/6] Modified ean13_barcode to human_barcode for label printer base_tube. --- lib/label_printer/label_printer/label/base_tube.rb | 2 +- spec/lib/label_printer/asset_labels_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/label_printer/label_printer/label/base_tube.rb b/lib/label_printer/label_printer/label/base_tube.rb index 91d6cf678b..e5dab0093e 100644 --- a/lib/label_printer/label_printer/label/base_tube.rb +++ b/lib/label_printer/label_printer/label/base_tube.rb @@ -32,7 +32,7 @@ def round_label_bottom_line(tube) end def barcode(tube) - tube.ean13_barcode + tube.human_barcode end def tubes diff --git a/spec/lib/label_printer/asset_labels_spec.rb b/spec/lib/label_printer/asset_labels_spec.rb index e94b62037a..e3f2dd6025 100644 --- a/spec/lib/label_printer/asset_labels_spec.rb +++ b/spec/lib/label_printer/asset_labels_spec.rb @@ -73,7 +73,8 @@ bottom_line: date, round_label_top_line: asset.prefix, round_label_bottom_line: asset.barcode_number, - barcode: asset.machine_barcode.to_s } } + barcode: asset.human_barcode + } } end end From 73fb3a1561223142668fb9b99a14179bf4e4f98c Mon Sep 17 00:00:00 2001 From: Stephen Inglis Date: Fri, 7 Aug 2020 09:43:12 +0100 Subject: [PATCH 4/6] Rubocopped. --- spec/lib/label_printer/asset_labels_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/lib/label_printer/asset_labels_spec.rb b/spec/lib/label_printer/asset_labels_spec.rb index e3f2dd6025..43d35920be 100644 --- a/spec/lib/label_printer/asset_labels_spec.rb +++ b/spec/lib/label_printer/asset_labels_spec.rb @@ -73,8 +73,7 @@ bottom_line: date, round_label_top_line: asset.prefix, round_label_bottom_line: asset.barcode_number, - barcode: asset.human_barcode - } } + barcode: asset.human_barcode } } end end From 6c8e47e51170dcb5ea4d4f0d06bfdb76f83e3e76 Mon Sep 17 00:00:00 2001 From: Stephen Inglis Date: Fri, 7 Aug 2020 10:49:17 +0100 Subject: [PATCH 5/6] Fixed unit tests. --- test/lib/label_printer/batch_multiplex_test.rb | 2 +- test/lib/label_printer/plate_to_tube_test.rb | 2 +- test/lib/label_printer/sample_manifest_multiplex_test.rb | 2 +- test/lib/label_printer/sample_manifest_tube_test.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/lib/label_printer/batch_multiplex_test.rb b/test/lib/label_printer/batch_multiplex_test.rb index 056cd4e70b..fecb22580b 100644 --- a/test/lib/label_printer/batch_multiplex_test.rb +++ b/test/lib/label_printer/batch_multiplex_test.rb @@ -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.human_barcode } end test 'should return correct tubes' do diff --git a/test/lib/label_printer/plate_to_tube_test.rb b/test/lib/label_printer/plate_to_tube_test.rb index 33a2f063f6..c3f2d261d5 100644 --- a/test/lib/label_printer/plate_to_tube_test.rb +++ b/test/lib/label_printer/plate_to_tube_test.rb @@ -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.human_barcode } end test 'should have tubes' do diff --git a/test/lib/label_printer/sample_manifest_multiplex_test.rb b/test/lib/label_printer/sample_manifest_multiplex_test.rb index 35852e6311..f6ff910651 100644 --- a/test/lib/label_printer/sample_manifest_multiplex_test.rb +++ b/test/lib/label_printer/sample_manifest_multiplex_test.rb @@ -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.human_barcode } end test 'should return correct tubes' do diff --git a/test/lib/label_printer/sample_manifest_tube_test.rb b/test/lib/label_printer/sample_manifest_tube_test.rb index 1c9b3dc5cf..5002f97bb7 100644 --- a/test/lib/label_printer/sample_manifest_tube_test.rb +++ b/test/lib/label_printer/sample_manifest_tube_test.rb @@ -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.human_barcode } end test 'should return the right list of tubes' do From 5557cb10b32988714b2fbbeccc2166a175a344d3 Mon Sep 17 00:00:00 2001 From: Stephen Inglis Date: Fri, 7 Aug 2020 13:32:53 +0100 Subject: [PATCH 6/6] Changed human_barcode to machine_barcode. --- lib/label_printer/label_printer/label/base_tube.rb | 2 +- spec/lib/label_printer/asset_labels_spec.rb | 2 +- test/lib/label_printer/batch_multiplex_test.rb | 2 +- test/lib/label_printer/plate_to_tube_test.rb | 2 +- test/lib/label_printer/sample_manifest_multiplex_test.rb | 2 +- test/lib/label_printer/sample_manifest_tube_test.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/label_printer/label_printer/label/base_tube.rb b/lib/label_printer/label_printer/label/base_tube.rb index e5dab0093e..826e42a3fd 100644 --- a/lib/label_printer/label_printer/label/base_tube.rb +++ b/lib/label_printer/label_printer/label/base_tube.rb @@ -32,7 +32,7 @@ def round_label_bottom_line(tube) end def barcode(tube) - tube.human_barcode + tube.machine_barcode end def tubes diff --git a/spec/lib/label_printer/asset_labels_spec.rb b/spec/lib/label_printer/asset_labels_spec.rb index 43d35920be..2bdd08aa99 100644 --- a/spec/lib/label_printer/asset_labels_spec.rb +++ b/spec/lib/label_printer/asset_labels_spec.rb @@ -73,7 +73,7 @@ bottom_line: date, round_label_top_line: asset.prefix, round_label_bottom_line: asset.barcode_number, - barcode: asset.human_barcode } } + barcode: asset.machine_barcode } } end end diff --git a/test/lib/label_printer/batch_multiplex_test.rb b/test/lib/label_printer/batch_multiplex_test.rb index fecb22580b..eb4d7f3ae3 100644 --- a/test/lib/label_printer/batch_multiplex_test.rb +++ b/test/lib/label_printer/batch_multiplex_test.rb @@ -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.human_barcode } + barcode: tube1.machine_barcode } end test 'should return correct tubes' do diff --git a/test/lib/label_printer/plate_to_tube_test.rb b/test/lib/label_printer/plate_to_tube_test.rb index c3f2d261d5..8e4c629d93 100644 --- a/test/lib/label_printer/plate_to_tube_test.rb +++ b/test/lib/label_printer/plate_to_tube_test.rb @@ -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.human_barcode } + barcode: tube1.machine_barcode } end test 'should have tubes' do diff --git a/test/lib/label_printer/sample_manifest_multiplex_test.rb b/test/lib/label_printer/sample_manifest_multiplex_test.rb index f6ff910651..66fe61012d 100644 --- a/test/lib/label_printer/sample_manifest_multiplex_test.rb +++ b/test/lib/label_printer/sample_manifest_multiplex_test.rb @@ -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.human_barcode } + barcode: tube1.machine_barcode } end test 'should return correct tubes' do diff --git a/test/lib/label_printer/sample_manifest_tube_test.rb b/test/lib/label_printer/sample_manifest_tube_test.rb index 5002f97bb7..7e8446bd40 100644 --- a/test/lib/label_printer/sample_manifest_tube_test.rb +++ b/test/lib/label_printer/sample_manifest_tube_test.rb @@ -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.human_barcode } + barcode: tube1.machine_barcode } end test 'should return the right list of tubes' do