Skip to content

Commit 616d08c

Browse files
committed
Remove unused function parse_salary
1 parent a8134ee commit 616d08c

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

app/models/opportunity.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,6 @@ def self.human_attribute_name(attr,options={})
7171
HUMANIZED_ATTRIBUTES[attr.to_sym] || super
7272
end
7373

74-
def self.parse_salary(salary_string)
75-
salary_string.match(/(\d+)\s*([kK]?)/)
76-
number, thousands = Regexp.last_match[1], Regexp.last_match[2]
77-
78-
if number.nil?
79-
0
80-
else
81-
salary = number.to_i
82-
if thousands.downcase == 'k' || salary < 1000
83-
salary * 1000
84-
else
85-
salary
86-
end
87-
end
88-
end
89-
9074
def self.based_on(tags)
9175
query_string = "tags:#{tags.join(' OR ')}"
9276
failover_scope = Opportunity.joins('inner join taggings on taggings.taggable_id = opportunities.id').joins('inner join tags on taggings.tag_id = tags.id').where("taggings.taggable_type = 'Opportunity' AND taggings.context = 'tags'").where('lower(tags.name) in (?)', tags.map(&:downcase)).group('opportunities.id').order('count(opportunities.id) desc')

spec/models/opportunity_spec.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,6 @@
7777
end
7878
end
7979

80-
describe 'parse job salary' do
81-
it 'should parse salaries correctly' do
82-
# TODO: Refactor api calls to Sidekiq job
83-
VCR.use_cassette('Opportunity') do
84-
85-
salary = Opportunity.parse_salary('100000')
86-
expect(salary).to eq(100_000)
87-
salary = Opportunity.parse_salary('100')
88-
expect(salary).to eq(100_000)
89-
salary = Opportunity.parse_salary('100k')
90-
expect(salary).to eq(100_000)
91-
salary = Opportunity.parse_salary('100 K')
92-
expect(salary).to eq(100_000)
93-
94-
end
95-
end
96-
end
97-
9880
describe 'apply for job' do
9981
it 'should create a valid application' do
10082
# TODO: Refactor api calls to Sidekiq job

0 commit comments

Comments
 (0)