summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-12-04 12:55:23 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2015-12-11 18:02:09 +0100
commite80e3f5372d6bcad1fbe04a85b3086bb66794828 (patch)
tree16b1539cfd158ecac7fe05d595cbba30b8bc1a04 /app/models/commit_status.rb
parent8b4cdc50fca816b4f56f8579e17c4dba836ec797 (diff)
downloadgitlab-ce-e80e3f5372d6bcad1fbe04a85b3086bb66794828.tar.gz
Migrate CI::Project to Project
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index ff619965a57..579b638706d 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -30,6 +30,7 @@
class CommitStatus < ActiveRecord::Base
self.table_name = 'ci_builds'
+ belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
belongs_to :commit, class_name: 'Ci::Commit'
belongs_to :user
@@ -49,6 +50,7 @@ class CommitStatus < ActiveRecord::Base
scope :latest, -> { where(id: unscope(:select).select('max(id)').group(:name, :ref)) }
scope :ordered, -> { order(:ref, :stage_idx, :name) }
scope :for_ref, ->(ref) { where(ref: ref) }
+ scope :has_coverage?, -> { where.not(coverage: nil).any? }
state_machine :status, initial: :pending do
event :run do
@@ -86,7 +88,7 @@ class CommitStatus < ActiveRecord::Base
state :canceled, value: 'canceled'
end
- delegate :sha, :short_sha, :gl_project,
+ delegate :sha, :short_sha, :project,
to: :commit, prefix: false
# TODO: this should be removed with all references