Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Oct 29, 2024
1 parent 68e4be2 commit 37fbf30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion app/controllers/samples_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def filter_linked_samples(samples, link, options, template_attribute)
raise ArgumentError, "Invalid linking method provided. '#{link}' is not allowed!"
end

# template_attribute_title = template_attribute&.title
samples.select do |s|
s.send(link).any? do |x|
selected = match_attribute_value(x, template_attribute, options[:attribute_value])
Expand Down
21 changes: 12 additions & 9 deletions test/functional/samples_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ class SamplesControllerTest < ActionController::TestCase
include HtmlHelper
include GeneralAuthorizationTestCases

def setup
@source_characteristic_isa_tag = FactoryBot.create(:source_characteristic_isa_tag)
@sample_characteristic_isa_tag = FactoryBot.create(:sample_characteristic_isa_tag)
@other_material_characteristic_isa_tag = FactoryBot.create(:other_material_characteristic_isa_tag)
Seek::Samples::BaseType::ALL_TYPES.each do |type|
FactoryBot.create(:string_sample_attribute_type, title: "#{type} attibute type", base_type: type)
end
end

test 'should return 406 when requesting RDF' do
login_as(FactoryBot.create(:user))
sample = FactoryBot.create :sample, contributor: User.current_user.person
Expand Down Expand Up @@ -1274,6 +1265,7 @@ def setup
end

test 'query samples by template attributes for \'seek sample\' type' do
setup_est_query
with_config_value(:isa_json_compliance_enabled, true) do
person, project, template1, template2, template3, type1, type2, type3 = template_query_setup.values_at(:person, :project, :begin_template, :middle_template, :end_template, :begin_type, :middle_type, :end_type)
login_as(person)
Expand Down Expand Up @@ -1400,6 +1392,7 @@ def setup
end

test 'query samples by template attributes for \'boolean\' type' do
setup_est_query
with_config_value(:isa_json_compliance_enabled, true) do
person, project, template1, template2, template3, type1, type2, type3 = template_query_setup(Seek::Samples::BaseType::BOOLEAN).values_at(:person, :project, :begin_template, :middle_template, :end_template, :begin_type, :middle_type, :end_type)

Expand Down Expand Up @@ -1559,6 +1552,7 @@ def setup
end

test 'query samples by template attributes for numeric types' do
setup_est_query
# Numeric types
# Integer
# Float
Expand Down Expand Up @@ -1811,6 +1805,15 @@ def setup

private

def setup_est_query
@source_characteristic_isa_tag = FactoryBot.create(:source_characteristic_isa_tag)
@sample_characteristic_isa_tag = FactoryBot.create(:sample_characteristic_isa_tag)
@other_material_characteristic_isa_tag = FactoryBot.create(:other_material_characteristic_isa_tag)
Seek::Samples::BaseType::ALL_TYPES.each do |type|
FactoryBot.create(:string_sample_attribute_type, title: "#{type} attibute type", base_type: type)
end
end

def populated_patient_sample
person = FactoryBot.create(:person)
sample = Sample.new title: 'My Sample', policy: FactoryBot.create(:public_policy),
Expand Down

0 comments on commit 37fbf30

Please sign in to comment.