From 0d37651a3d21f84f27440abcd15e1b8b1b75f7eb Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 13 Jan 2025 18:17:31 +0000 Subject: [PATCH 1/2] Add a state filter for labware --- app/resources/api/v2/shared_behaviour/labware.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/resources/api/v2/shared_behaviour/labware.rb b/app/resources/api/v2/shared_behaviour/labware.rb index 789e2614e1..943e29a134 100644 --- a/app/resources/api/v2/shared_behaviour/labware.rb +++ b/app/resources/api/v2/shared_behaviour/labware.rb @@ -62,6 +62,7 @@ module Labware filter :updated_at_gt, apply: lambda { |records, value, _options| records.where('labware.updated_at > ?', value[0].to_date) } filter :include_used, apply: ->(records, value, _options) { records.include_labware_with_children(value) } + filter :state, apply: ->(records, value, _options) { records.in_state(value.flatten) } end # Custom methods From d86470e3faa42a5e58090bb5a485102024fe686e Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 13 Jan 2025 18:17:48 +0000 Subject: [PATCH 2/2] Fix a typo in the state.rb file comments --- app/models/transfer/state.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/transfer/state.rb b/app/models/transfer/state.rb index bd35775706..082eb52dc1 100644 --- a/app/models/transfer/state.rb +++ b/app/models/transfer/state.rb @@ -67,7 +67,7 @@ def self.included(base) # rubocop:todo Metrics/MethodLength states = Array(states).map(&:to_s) # If all of the states are present there is no point in actually adding this set of conditions because - # we're basically looking for all of the plates. + # we're basically looking for all of the tubes. if states.sort != ALL_STATES.sort join_options = [ # rubocop:todo Layout/LineLength