alphagov/trade-tariff-frontend — pull request #53 by sauliusg (2013-01-29 14:16:51+00:00)
Title: Fix measure with complex measure conditions rendering.

To be honest, I think it's error in the data as measure conditions are:

```ruby
=> [#549716, :measure_sid=>2891442, :condition_code=>"L", :component_sequence_number=>1, :condition_duty_amount=>58.23, :condition_monetary_unit_code=>"EUR", :condition_measurement_unit_code=>"DTN", :condition_measurement_unit_qualifier_code=>nil, :action_code=>"01", :certificate_type_code=>nil, :certificate_code=>nil, :created_at=>nil, :updated_at=>nil}>,
#549717, :measure_sid=>2891442, :condition_code=>"L", :component_sequence_number=>2, :condition_duty_amount=>38.82, :condition_monetary_unit_code=>"EUR", :condition_measurement_unit_code=>"DTN", :condition_measurement_unit_qualifier_code=>nil, :action_code=>"01", :certificate_type_code=>nil, :certificate_code=>nil, :created_at=>nil, :updated_at=>nil}>,
#549718, :measure_sid=>2891442, :condition_code=>"L", :component_sequence_number=>3, :condition_duty_amount=>35.19, :condition_monetary_unit_code=>"EUR", :condition_measurement_unit_code=>"DTN", :condition_measurement_unit_qualifier_code=>nil, :action_code=>"01", :certificate_type_code=>nil, :certificate_code=>nil, :created_at=>nil, :updated_at=>nil}>,
#549719, :measure_sid=>2891442, :condition_code=>"L", :component_sequence_number=>5, :condition_duty_amount=>0.0, :condition_monetary_unit_code=>"EUR", :condition_measurement_unit_code=>"DTN", :condition_measurement_unit_qualifier_code=>nil, :action_code=>"07", :certificate_type_code=>nil, :certificate_code=>nil, :created_at=>nil, :updated_at=>nil}>]
```

So sequence numbers are 1,2,3,5(?). Previous code version assumed that they will be ordered correctly. Reworked to use sorting and pick the one before actual measure condition.

This is for https://www.pivotaltracker.com/story/show/43298641.