lib/double_entry/reporting/line_aggregate_filter.rb
# a lot of the trickier reports will use filters defined
# in filter_criteria to bring in data from other tables.
# For example:
#
#   filter_criteria = [
#     # an example of calling a named scope called with arguments
#     {
#       :scope => {
#         :name => :ten_dollar_purchases_by_category,
#         :arguments => [:cat_videos, :cat_pictures]
#       }
#     },
#     # an example of calling a named scope with no arguments
#     {
#       :scope => {
#         :name => :ten_dollar_purchases
#       }
#     },
#     # an example of providing multiple metadatum criteria to filter on
#     {
#       :metadata => {
#         :meme => :business_cat,
#         :category => :fun_times,
#       }
#     }
#   ]
a lot of the trickier reports will use filters defined
in filter_criteria to bring in data from other tables.
For example.


a lot of the trickier reports will use filters defined in filter_criteria to bring in data from other tables . For example .
def apply_filter_criteria
        @filter_criteria.reduce(DoubleEntry::Line) do |collection, filter|
          if filter[:scope].present?
            filter_by_scope(collection, filter[:scope])
          elsif filter[:metadata].present?
            filter_by_metadata(collection, filter[:metadata])
          else
            collection
          end
        end
      end
def apply_filter_criteria @filter_criteria . reduce ( DoubleEntry :: Line ) do | collection , filter | if filter [ :scope ] . present? filter_by_scope ( collection , filter [ :scope ] ) elsif filter [ :metadata ] . present? filter_by_metadata ( collection , filter [ :metadata ] ) else collection end end end
a lot of the trickier reports will use filters defined
in filter_criteria to bring in data from other tables.
a lot of the trickier reports will use filters defined in filter_criteria to bring in data from other tables .