Class: Action::Project::Suggestions

Inherits:
Show
  • Object
show all
Defined in:
app/services/action/project/suggestions.rb

Constant Summary collapse

FILE_COUNT =
5
GRADES_TO_DISPLAY =
%w(B C U)
GRADE_WEIGHTS =
[0.2, 0.4, 0.4]
MIN_PRIORITY =
0

Constants inherited from Show

Action::Project::Show::MAX_SUGGESTIONS

Instance Method Summary collapse

Methods included from SetProjectAndBranch

#set_project_and_branch

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(params) ⇒ Suggestions

Returns a new instance of Suggestions.


12
13
14
15
16
17
18
19
20
# File 'app/services/action/project/suggestions.rb', line 12

def initialize(params)
  super
  if @code_objects
    suggested = filter_suggested_code_objects(@code_objects)
    @suggestions = InchCI::GradeListCollection.new(suggested)
    files = suggested.map(&:filename)
    @files = sort_files_by_frequency(files)[0...FILE_COUNT]
  end
end