Sha256: 70ae52777cf8fb5fe8920d7ea4ad258a18fe15b9d5c5bad71a655880c0a2da5e

Contents?: true

Size: 503 Bytes

Versions: 2

Compression:

Stored size: 503 Bytes

Contents

module ByStar
  module Calculations
    module Sum
      def sum_by_year(field, year=Time.zone.now.year, options={})
        sum(field, :conditions => conditions_for_range(start_of_year(year), end_of_year(year), options))
      end

      def sum_by_month(field, month=Time.zone.now.month, options={})
        year, month = work_out_month(month, options)
        sum(field, :conditions => conditions_for_range(start_of_month(month, year), end_of_month(month, year), options))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
by_star-0.3.1 lib/calculations/sum.rb
by_star-0.3.0 lib/calculations/sum.rb