Sha256: 21fd1eaf416d69a646e602b42b259eaa1af0e00c7215e377f727a2a0680aa238
Contents?: true
Size: 864 Bytes
Versions: 28
Compression:
Stored size: 864 Bytes
Contents
module Workarea module Reports class SalesByTender include Report self.reporting_class = Metrics::TenderByDay self.sort_fields = %w(orders revenue) def aggregation [filter_date_range, project_used_fields, group_by_country] end def filter_date_range { '$match' => { 'reporting_on' => { '$gte' => starts_at, '$lte' => ends_at } } } end def project_used_fields { '$project' => { 'tender' => 1, 'orders' => 1, 'revenue' => 1 } } end def group_by_country { '$group' => { '_id' => '$tender', 'orders' => { '$sum' => '$orders' }, 'revenue' => { '$sum' => '$revenue' } } } end end end end
Version data entries
28 entries across 28 versions & 1 rubygems