|
|
@ -13,18 +13,18 @@ module Csv |
|
|
|
|
|
|
|
|
|
|
|
case @download_type |
|
|
|
case @download_type |
|
|
|
when "schemes" |
|
|
|
when "schemes" |
|
|
|
schemes.each do |scheme| |
|
|
|
schemes.find_each do |scheme| |
|
|
|
csv << scheme_attributes.map { |attribute| scheme_value(attribute, scheme) } |
|
|
|
csv << scheme_attributes.map { |attribute| scheme_value(attribute, scheme) } |
|
|
|
end |
|
|
|
end |
|
|
|
when "locations" |
|
|
|
when "locations" |
|
|
|
schemes.each do |scheme| |
|
|
|
schemes.find_each do |scheme| |
|
|
|
scheme.locations.each do |location| |
|
|
|
scheme.locations.find_each do |location| |
|
|
|
csv << [scheme.id_to_display] + location_attributes.map { |attribute| location_value(attribute, location) } |
|
|
|
csv << [scheme.id_to_display] + location_attributes.map { |attribute| location_value(attribute, location) } |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
when "combined" |
|
|
|
when "combined" |
|
|
|
schemes.each do |scheme| |
|
|
|
schemes.find_each do |scheme| |
|
|
|
scheme.locations.each do |location| |
|
|
|
scheme.locations.find_each do |location| |
|
|
|
csv << scheme_attributes.map { |attribute| scheme_value(attribute, scheme) } + location_attributes.map { |attribute| location_value(attribute, location) } |
|
|
|
csv << scheme_attributes.map { |attribute| scheme_value(attribute, scheme) } + location_attributes.map { |attribute| location_value(attribute, location) } |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|