Skip to content

Commit

Permalink
sector_helpers.rb - updated the function in high_level_sector_list so…
Browse files Browse the repository at this point in the history
… that it sums buudget values correctly
  • Loading branch information
Ross Clements committed Sep 2, 2015
1 parent 6d508b4 commit 3f3d07f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions helpers/sector_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ def high_level_sector_list
sectorValues = JSON.parse(sectorValuesJSON)

highLevelSector = JSON.parse(File.read('data/test_sh.json'))
# sectorValues = JSON.parse(File.read('data/test_budget.json'))
# sectorValues = JSON.parse(File.read('data/test_budget.json'))


highLevelSector.map do |elem|
{
:code => elem["High Level Code (L1)"],
:name => elem["High Level Sector Description"],
:budget => sectorValues.find do |source|
source["sector"]["code"] == elem["Code (L3)"].to_s
end["budget"]
:budget => sectorValues.select do |source|
source["sector"]["code"] == elem["Code (L3)"].to_s
end.map{|elem|elem["budget"]}.inject(:+)

}
end

Expand Down

0 comments on commit 3f3d07f

Please sign in to comment.