lib/groupdate/adapters/postgresql_adapter.rb in groupdate-6.5.0 vs lib/groupdate/adapters/postgresql_adapter.rb in groupdate-6.5.1

- old
+ new

@@ -21,10 +21,10 @@ when :month_of_year ["EXTRACT(MONTH FROM #{day_start_column})::integer", time_zone, day_start_interval] when :week ["(DATE_TRUNC('day', #{day_start_column} - INTERVAL '1 day' * ((? + EXTRACT(DOW FROM #{day_start_column})::integer) % 7)) + INTERVAL ?)::date", time_zone, day_start_interval, 13 - week_start, time_zone, day_start_interval, day_start_interval] when :custom - if @relation.connection.adapter_name == "Redshift" + if @adapter_name == "Redshift" ["TIMESTAMP 'epoch' + (FLOOR(EXTRACT(EPOCH FROM #{column}::timestamp) / ?) * ?) * INTERVAL '1 second'", n_seconds, n_seconds] else ["TO_TIMESTAMP(FLOOR(EXTRACT(EPOCH FROM #{column}::timestamptz) / ?) * ?)", n_seconds, n_seconds] end when :day, :month, :quarter, :year