diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-04 15:09:04 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-04 15:09:04 +0200 |
commit | 98051316f821d99df2790709b364b3ecce19468e (patch) | |
tree | 06360ad959256bdda843b93ff930d683555b13b9 /app/models/commit.rb | |
parent | 6b9019bbc2f61c7751080f9323eba4cb5cf62dcf (diff) | |
download | gitlab-ci-98051316f821d99df2790709b364b3ecce19468e.tar.gz |
Partly integrate commits
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index cb08c24..08e2888 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -15,12 +15,17 @@ class Commit < ActiveRecord::Base belongs_to :project has_many :builds + has_many :jobs, through: :builds serialize :push_data validates_presence_of :ref, :sha, :before_sha, :push_data validate :valid_commit_sha + def to_param + sha + end + def last_build builds.last end @@ -103,4 +108,27 @@ class Commit < ActiveRecord::Base build end end + + def builds_without_retry + builds.where('id IN (SELECT MAX(id) FROM builds GROUP BY job_id)') + end + + def status + 'success' + end + + def success? + end + + def failed? + end + + def canceled? + end + + def duration + end + + def finished_at + end end |