Skip to content

Commit

Permalink
Fix sample_controller_test
Browse files Browse the repository at this point in the history
Add a contributor to the sample types in the test fixes the failing
tests regarding sample type links with referring samples linked to it.
  • Loading branch information
kdp-cloud committed Oct 8, 2024
1 parent c88d4d2 commit 7f1b1d3
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 126 deletions.
4 changes: 2 additions & 2 deletions app/helpers/samples_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ def sample_type_link(sample, user=User.current_user)
return nil if Seek::Config.isa_json_compliance_enabled && !sample.sample_type.template_id.nil?

if (sample.sample_type.can_view?(user))
link_to sample.sample_type.title,sample.sample_type
link_to sample.sample_type.title, sample.sample_type
else
link_to sample.sample_type.title,sample_type_path(sample.sample_type, referring_sample_id:sample.id)
link_to sample.sample_type.title, sample_type_path(sample.sample_type, referring_sample_id: sample.id)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/sample_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def check_referring_sample_permission(user, referring_sample)
referring_sample.try(:sample_type) == self && referring_sample.can_view?(user)
end

# whether it is assocaited with any public samples
# whether it is associated with any public samples
def public_samples?
samples.joins(:policy).where('policies.access_type >= ?', Policy::VISIBLE).any?
end
Expand Down
Loading

0 comments on commit 7f1b1d3

Please sign in to comment.