Skip to content

Commit

Permalink
Rename local_genotype to snp_variation SnpediaPaper
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujigiri committed Jul 8, 2015
1 parent e6ac9c5 commit 4126d3a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/helpers/snpedia_papers_helper.rb
@@ -1,7 +1,7 @@
module SnpediaPapersHelper
def bold_if_matching_local_genotype(snpedia_paper, user_snp, &block)
def bold_if_matching_variation(snpedia_paper, user_snp, &block)
if snpedia_paper && user_snp &&
snpedia_paper.local_genotype == user_snp.local_genotype.split('').sort.join
snpedia_paper.snp_variation == user_snp.local_genotype.split('').sort.join

content_tag('b', &block)
else
Expand Down
2 changes: 1 addition & 1 deletion app/models/snpedia_paper.rb
Expand Up @@ -10,7 +10,7 @@ def summary
read_attribute(:summary).presence || "No summary provided."
end

def local_genotype
def snp_variation
url =~ /\((.*);(.*)\)$/
"#{$1}#{$2}"
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/snps/_snpedia_papers.html.erb
Expand Up @@ -9,8 +9,8 @@
<% snp.snpedia_papers.each do |p| %>
<tr>
<td>
<%= bold_if_matching_local_genotype(p, user_snp) do %>
<%= link_to "#{snp.name} #{p.local_genotype.split('').join('/')}", p.url %>
<%= bold_if_matching_variation(p, user_snp) do %>
<%= link_to "#{snp.name} #{p.snp_variation.split('').join('/')}", p.url %>
<% end %>
</td>
<td><b><%= p.summary.capitalize %></b></td>
Expand Down
6 changes: 3 additions & 3 deletions spec/models/snpedia_paper_spec.rb
Expand Up @@ -3,9 +3,9 @@
build(:snpedia_paper, url: 'http://www.snpedia.com/index.php/Rs1234(A;C)')
end

describe '#local_genotype' do
it 'extracts the local genotype from the url' do
expect(subject.local_genotype).to eq('AC')
describe '#snp_variation' do
it 'extracts the SNP variation from the url' do
expect(subject.snp_variation).to eq('AC')
end
end
end
2 changes: 1 addition & 1 deletion spec/views/snps/_snpedia_papers.html.erb_spec.rb
Expand Up @@ -2,7 +2,7 @@
let(:snpedia_paper) do
double(:snpedia_paper, url: 'http://www.snpedia.com/index.php/Rs1234(A;C)',
summary: 'Green hair',
local_genotype: 'AC')
snp_variation: 'AC')
end
let(:snp) { double('snp', name: 'rs1234', snpedia_papers: [snpedia_paper]) }

Expand Down

0 comments on commit 4126d3a

Please sign in to comment.