Module: ReportsHelper
- Defined in:
- app/helpers/reports_helper.rb
Instance Method Summary collapse
-
#bucket_data(array, by) ⇒ Object
assume the array to contains hashes with :data option to bucket second arg is the function to call, ie :day , :week (on a time object created fro the integer) the hash stays, but the data values are replaced.
- #group_options ⇒ Object
Instance Method Details
#bucket_data(array, by) ⇒ Object
assume the array to contains hashes with :data option to bucket
second arg is the function to call, ie :day , :week (on a time object created fro the integer) the hash stays, but the data values are replaced
7 8 9 10 11 12 |
# File 'app/helpers/reports_helper.rb', line 7 def bucket_data( array , by ) by = by.to_sym array.each do |has| has[:data] = bucket_array( has[:data] , by ) end end |
#group_options ⇒ Object
14 15 16 17 18 19 |
# File 'app/helpers/reports_helper.rb', line 14 def opt = { t("all") => :all , t("category") => :by_category , t("supplier") => :by_supplier , t("product") => :by_product , t("product_line") => :by_product_line} # Property.all.each { |p| opt[p.name] = p.name } opt end |