Pushed widget improved

This commit is contained in:
randx 2012-06-21 18:41:22 +03:00
parent ed247b3893
commit 77cf662034
7 changed files with 22 additions and 16 deletions

View file

@ -48,8 +48,8 @@ module Account
end
def recent_push project_id = nil
# Get push events not earlier than 6 hours ago
events = recent_events.code_push.where("created_at > ?", Time.now - 6.hours)
# Get push events not earlier than 2 hours ago
events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
events = events.where(:project_id => project_id) if project_id
# Take only latest one

View file

@ -9,6 +9,10 @@ module PushEvent
data[:ref]["refs/tags"]
end
def branch?
data[:ref]["refs/heads"]
end
def new_branch?
commit_from =~ /^00000/
end
@ -87,4 +91,8 @@ module PushEvent
def push_with_commits?
md_ref? && commits.any? && parent_commit && last_commit
end
def last_push_to_non_root?
branch? && project.default_branch != branch_name
end
end