Skip to content

Commit

Permalink
store standard availability
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmike committed Jun 22, 2012
1 parent da7cced commit 8f2f15d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,22 @@ task :update do
country_select.select name
browser.text_field(:name => 'poids').when_present.set '1'
Watir::Wait.until { browser.select_list(:name => 'natureEnvoi').options.size > 0 }
browser.select_list(:name => 'natureEnvoi').select 'Non standard'
if browser.select_list(:name => 'natureEnvoi').option(:text => "Standard").present?
select_option = "Standard"
price_diff = 0
standard_available = true
else
select_option = "Non standard"
price_diff = 6
standard_available = false
end

browser.select_list(:name => 'natureEnvoi').select select_option
browser.image(:src => "img/misc/boutonCalculTarif.gif").when_present.click
price_text = browser.p(:class => "price").when_present.text
price, = price_text.scan(/(\d+\.\d{2})/).first
if price
price = BigDecimal(price) - 6
price = BigDecimal(price) - price_diff
zone = zone_prices[price]
puts "Zone not found for price #{price.to_s} on #{name}" unless zone
else
Expand All @@ -53,6 +63,7 @@ task :update do
name: name,
code: code,
zone: zone,
standard_available: standard_available,
}
p country_data
data << country_data
Expand Down

0 comments on commit 8f2f15d

Please sign in to comment.