Class: Action::Project::Show

Inherits:
Object
  • Object
show all
Includes:
SetProjectAndBranch, InchCI::Action
Defined in:
app/services/action/project/show.rb

Direct Known Subclasses

History, Suggestions

Constant Summary collapse

MAX_SUGGESTIONS =
20

Instance Method Summary collapse

Methods included from SetProjectAndBranch

#set_project_and_branch

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(params) ⇒ Show

Returns a new instance of Show.


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/action/project/show.rb', line 15

def initialize(params)
  set_project_and_branch(params)
  @build = find_pending_build(params)
  if revision = find_revision(@branch, params)
    @user = project.user
    @revision = RevisionPresenter.new(revision)
    @code_objects = find_code_objects(revision)
    @collection = create_collection(@code_objects)
    @suggestion_count = @code_objects.select do |code_object|
        code_object.grade != 'A'
      end.size
    if @suggestion_count > MAX_SUGGESTIONS
      @suggestion_count = "#{MAX_SUGGESTIONS}+"
    end
  end
end