@ -123,7 +123,7 @@ class Report < ActiveRecord::Base
def_delegators :transformer , :column_first , :row_first
def_delegators :chain , :empty_chain , :top , :bottom , :chain_collect , :sql_statement , :all_group_fields , :child , :clear , :result
def_delegators :result , :each_direct_result , :recursive_each , :recursive_each_with_level , :each , :each_row , :count ,
:units , :size , : final_number
:units , :final_number
def_delegators :table , :row_index , :colum_index
def to_a
@ -134,21 +134,27 @@ class Report < ActiveRecord::Base
chain . to_s
end
def size
size = 0
recursive_each { | r | size += r . size }
size
end
def hash
report_string = " "
report_string . concat ( 'filters: [' )
report_string . concat ( filters . map { | f |
f . class . underscore_name + f . operator . to_s + ( f . values ? f . values . to_json : " " )
report_string . concat ( filters . map { | f |
f . class . underscore_name + f . operator . to_s + ( f . values ? f . values . to_json : " " )
} . sort . join ( ', ' ) )
report_string . concat ( ']' )
report_string . concat ( ', group_bys: {' )
report_string . concat ( group_bys . group_by ( & :type ) . map { | t , gbs |
report_string . concat ( group_bys . group_by ( & :type ) . map { | t , gbs |
" #{ t } : [ #{ gbs . collect ( & :class ) . collect ( & :underscore_name ) . join ( ', ' ) } ] "
} . join ( ', ' ) )
report_string . concat ( '}' )
report_string . hash