summaryrefslogtreecommitdiff
path: root/lib/gitlab/cycle_analytics/production_stage.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-12-09 12:41:15 +0100
committerJames Lopez <james@jameslopez.es>2017-01-17 11:32:55 +0100
commit982d5a050667c517bbc996a08ca0922f2c5fbfb4 (patch)
tree785ca35f5b8497fc1d946e77da1f22056a3b1b60 /lib/gitlab/cycle_analytics/production_stage.rb
parent834bcacbaec837d8ec0a269f111bca769843bcb4 (diff)
downloadgitlab-ce-982d5a050667c517bbc996a08ca0922f2c5fbfb4.tar.gz
refactored metrics fetcher - merged into stage and events
Diffstat (limited to 'lib/gitlab/cycle_analytics/production_stage.rb')
-rw-r--r--lib/gitlab/cycle_analytics/production_stage.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/cycle_analytics/production_stage.rb b/lib/gitlab/cycle_analytics/production_stage.rb
index 104c6d3fd30..eb221c68324 100644
--- a/lib/gitlab/cycle_analytics/production_stage.rb
+++ b/lib/gitlab/cycle_analytics/production_stage.rb
@@ -1,6 +1,8 @@
module Gitlab
module CycleAnalytics
class ProductionStage < BaseStage
+ include ProductionHelper
+
def initialize(*args)
@start_time_attrs = issue_table[:created_at]
@end_time_attrs = mr_metrics_table[:first_deployed_to_production_at]
@@ -8,13 +10,18 @@ module Gitlab
super(*args)
end
- def stage
+ def name
:production
end
def description
"From issue creation until deploy to production"
end
+
+ def query
+ # Limit to merge requests that have been deployed to production after `@from`
+ query.where(mr_metrics_table[:first_deployed_to_production_at].gteq(@from))
+ end
end
end
end