gitlab-org--gitlab-foss/app/helpers/graph_helper.rb
Z.J. van de Weg 9b2ae90d2c Remove references to build in pipeline charts
Being the good boyscouts, but mainly because of [the comment in the
review](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12378#note_33302115)
the words used for classes and variables are changed to not use builds
anymore.
2017-06-23 14:50:03 +02:00

26 lines
740 B
Ruby

module GraphHelper
def get_refs(repo, commit)
refs = ""
# Commit::ref_names already strips the refs/XXX from important refs (e.g. refs/heads/XXX)
# so anything leftover is internally used by GitLab
commit_refs = commit.ref_names(repo).reject{ |name| name.starts_with?('refs/') }
refs << commit_refs.join(' ')
# append note count
refs << "[#{@graph.notes[commit.id]}]" if @graph.notes[commit.id] > 0
refs
end
def parents_zip_spaces(parents, parent_spaces)
ids = parents.map { |p| p.id }
ids.zip(parent_spaces)
end
def success_ratio(counts)
return 100 if counts[:failed].zero?
ratio = (counts[:success].to_f / (counts[:success] + counts[:failed])) * 100
ratio.to_i
end
end