summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb28
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