diff options
author | James Lopez <james@jameslopez.es> | 2016-10-20 10:08:53 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 08:22:55 +0100 |
commit | 1a4ff5d720fa0ec65f925ef381fced3d5f9a040f (patch) | |
tree | 554f05d5d011c0ca9a9ac2bd3765834f8a8693ce /lib/gitlab/database/date_time.rb | |
parent | 72660d58af13b4a768840307d2870ac08dd088ef (diff) | |
download | gitlab-ce-1a4ff5d720fa0ec65f925ef381fced3d5f9a040f.tar.gz |
Added code events spec and logic. Also fixed SQL issues and refactored the code a bit.
Diffstat (limited to 'lib/gitlab/database/date_time.rb')
-rw-r--r-- | lib/gitlab/database/date_time.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/database/date_time.rb b/lib/gitlab/database/date_time.rb index e2524886de2..38a6fd4276b 100644 --- a/lib/gitlab/database/date_time.rb +++ b/lib/gitlab/database/date_time.rb @@ -7,13 +7,13 @@ module Gitlab # # Note: For MySQL, the interval is returned in seconds. # For PostgreSQL, the interval is returned as an INTERVAL type. - def subtract_datetimes(query_so_far, end_time_attrs, start_time_attrs, as) + def subtract_datetimes(query_so_far, start_time_attrs, end_time_attrs, as) diff_fn = subtract_datetimes_diff(query_so_far, end_time_attrs, start_time_attrs) query_so_far.project(diff_fn.as(as)) end - def subtract_datetimes_diff(query_so_far, end_time_attrs, start_time_attrs) + def subtract_datetimes_diff(query_so_far, start_time_attrs, end_time_attrs) if Gitlab::Database.postgresql? Arel::Nodes::Subtraction.new( Arel::Nodes::NamedFunction.new("COALESCE", Array.wrap(end_time_attrs)), |