summaryrefslogtreecommitdiff
path: root/app/helpers/graph_helper.rb
blob: ab72442857b921d8986bb0f23f9558bdefcc1a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

module GraphHelper
  def refs(repo, commit)
    refs = [commit.ref_names(repo).join(' ')]

    # append note count
    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

    refs.join
  end

  def parents_zip_spaces(parents, parent_spaces)
    ids = parents.map(&:id)
    ids.zip(parent_spaces)
  end

  def success_ratio(counts)
    return 100 if counts[:failed] == 0

    ratio = (counts[:success].to_f / (counts[:success] + counts[:failed])) * 100
    ratio.to_i
  end

  def should_render_dora_charts
    false
  end

  def should_render_quality_summary
    false
  end
end

GraphHelper.prepend_mod_with('GraphHelper')