Sha256: 78ea5fb61ac046084319826301b1bd6eaa0dfabdd34d0795638352e44fe86ac8
Contents?: true
Size: 644 Bytes
Versions: 8
Compression:
Stored size: 644 Bytes
Contents
module ReportsKit module Reports module Adapters class Mysql def self.truncate_to_day(column) "DATE(#{column})" end def self.truncate_to_week(column) case ReportsKit.configuration.first_day_of_week when :sunday "DATE_SUB(DATE(#{column}), INTERVAL DAYOFWEEK(#{column}) - 1 DAY)" when :monday "DATE_SUB(DATE(#{column}), INTERVAL DAYOFWEEK(#{column}) - 2 DAY)" else raise ArgumentError.new("Unsupported first_day_of_week: #{ReportsKit.configuration.first_day_of_week}") end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems