summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-21 02:18:57 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-09-21 02:18:57 +0530
commit6df2d57394a48ac0528af722a41c41bcbc8166b2 (patch)
treedd7664d179a1a9f95efa6a11827ff8f94e7bbb90
parenta57c77f6c2aa79b23f9aa59e6552ffeb514607de (diff)
downloadgitlab-ce-6df2d57394a48ac0528af722a41c41bcbc8166b2.tar.gz
Improve indentation in `Gitlab::Database::Median`
-rw-r--r--lib/gitlab/database/median.rb29
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/gitlab/database/median.rb b/lib/gitlab/database/median.rb
index 9adacd64934..5db05b98d5a 100644
--- a/lib/gitlab/database/median.rb
+++ b/lib/gitlab/database/median.rb
@@ -30,12 +30,15 @@ module Gitlab
query = arel_table.
from(arel_table.project(Arel.sql('*')).order(arel_table[column_sym]).as(arel_table.table_name)).
project(average([arel_table[column_sym]], 'median')).
- where(Arel::Nodes::Between.new(
- Arel.sql("(select @row_id := @row_id + 1)"),
- Arel::Nodes::And.new(
- [Arel.sql('@ct/2.0'),
- Arel.sql('@ct/2.0 + 1')]
- ))).
+ where(
+ Arel::Nodes::Between.new(
+ Arel.sql("(select @row_id := @row_id + 1)"),
+ Arel::Nodes::And.new(
+ [Arel.sql('@ct/2.0'),
+ Arel.sql('@ct/2.0 + 1')]
+ )
+ )
+ ).
# Disallow negative values
where(arel_table[column_sym].gteq(0))
@@ -75,11 +78,15 @@ module Gitlab
# by 'where cte.row_id between cte.ct / 2.0 AND cte.ct / 2.0 + 1'). Find the average of the
# selected rows, and this is the median value.
cte_table.project(average([extract_epoch(cte_table[column_sym])], "median")).
- where(Arel::Nodes::Between.new(
- cte_table[:row_id],
- Arel::Nodes::And.new(
- [(cte_table[:ct] / Arel.sql('2.0')),
- (cte_table[:ct] / Arel.sql('2.0') + 1)]))).
+ where(
+ Arel::Nodes::Between.new(
+ cte_table[:row_id],
+ Arel::Nodes::And.new(
+ [(cte_table[:ct] / Arel.sql('2.0')),
+ (cte_table[:ct] / Arel.sql('2.0') + 1)]
+ )
+ )
+ ).
with(query_so_far, cte)
end