2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
module GraphHelper
|
2018-03-17 18:26:18 +05:30
|
|
|
def refs(repo, commit)
|
2018-12-05 23:21:45 +05:30
|
|
|
refs = [commit.ref_names(repo).join(' ')]
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
# append note count
|
2023-01-13 00:05:48 +05:30
|
|
|
unless Feature.enabled?(:disable_network_graph_notes_count, @project, type: :experiment)
|
|
|
|
notes_count = @graph.notes[commit.id]
|
|
|
|
refs << "[#{pluralize(notes_count, 'note')}]" if notes_count > 0
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
refs.join
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def parents_zip_spaces(parents, parent_spaces)
|
2023-03-17 16:20:25 +05:30
|
|
|
ids = parents.map(&:id)
|
2014-09-02 18:07:02 +05:30
|
|
|
ids.zip(parent_spaces)
|
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
def success_ratio(counts)
|
2020-10-24 23:57:45 +05:30
|
|
|
return 100 if counts[:failed] == 0
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
ratio = (counts[:success].to_f / (counts[:success] + counts[:failed])) * 100
|
2015-12-23 02:04:40 +05:30
|
|
|
ratio.to_i
|
|
|
|
end
|
2021-03-08 18:12:59 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
def should_render_dora_charts
|
2021-03-08 18:12:59 +05:30
|
|
|
false
|
|
|
|
end
|
2021-12-11 22:18:48 +05:30
|
|
|
|
|
|
|
def should_render_quality_summary
|
|
|
|
false
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2021-03-08 18:12:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
GraphHelper.prepend_mod_with('GraphHelper')
|