alphagov / trade-tariff-backend

Enabling the population and distribution via API of UK Customs tariffs and duties
MIT License
7 stars 6 forks source link

Allow to search for 08 and 09 (Chapters 8 and 9). #70

Closed saulius closed 11 years ago

saulius commented 11 years ago

Currently search will fail when searching for '08' and '09' (Chapter 8 and 9). I'm not entirely sure why, but:

~ (main) > sprintf("%02d", "7")
=> "07"
~ (main) > sprintf("%02d", "8")
=> "08"
~ (main) > sprintf("%02d", "07")
=> "07"
~ (main) > sprintf("%02d", "08")
ArgumentError: invalid value for Integer(): "08"
from (pry):4:in `sprintf'
~ (main) > sprintf("%02d", "09")
ArgumentError: invalid value for Integer(): "09"
from (pry):5:in `sprintf'
~ (main) > sprintf("%02d", "10")
=> "10"

So this change fixes it.

saulius commented 11 years ago

The answer to the life the universe and everything http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/128416