diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-19 19:56:27 +0200 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-27 12:47:44 +0200 |
commit | 4447006832d8955f371e2430988e0c95b20f155d (patch) | |
tree | 0d82fa7332f47bc79b647c77161f3c02237f93f4 /app | |
parent | 9c7bf123564ee3c045c2aa3625f8a691f91a23aa (diff) | |
download | gitlab-ce-4447006832d8955f371e2430988e0c95b20f155d.tar.gz |
Split pipelines by origin on usage datazj-usage-ping-only-gl-pipelines
When sending the usage data, it now includes all pipelines. This commit
will split the pipelines in two; internal and external.
This will lead to historical data being incorrectly marked this way.
Fixes gitlab-org/gitlab-ce#33172
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 1b3e5a25ac2..364858964b0 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -140,6 +140,7 @@ module Ci where(id: max_id) end end + scope :internal, -> { where(source: internal_sources) } def self.latest_status(ref = nil) latest(ref).status @@ -163,6 +164,10 @@ module Ci where.not(duration: nil).sum(:duration) end + def self.internal_sources + sources.reject { |source| source == "external" }.values + end + def stages_count statuses.select(:stage).distinct.count end |