Class: Ml::CandidateDetailsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/ml/candidate_details_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(candidate, current_user) ⇒ CandidateDetailsPresenter

Returns a new instance of CandidateDetailsPresenter.



7
8
9
10
# File 'app/presenters/ml/candidate_details_presenter.rb', line 7

def initialize(candidate, current_user)
  @candidate = candidate
  @current_user = current_user
end

Instance Method Details

#presentObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/presenters/ml/candidate_details_presenter.rb', line 12

def present
  {
    candidate: {
      info: {
        iid: candidate.iid,
        eid: candidate.eid,
        path_to_artifact: link_to_artifact,
        experiment_name: candidate.experiment.name,
        path_to_experiment: link_to_experiment,
        path: link_to_details,
        status: candidate.status,
        ci_job: job_info
      },
      params: candidate.params,
      metrics: candidate.metrics,
      metadata: candidate.
    }
  }
end

#present_as_jsonObject



32
33
34
# File 'app/presenters/ml/candidate_details_presenter.rb', line 32

def present_as_json
  Gitlab::Json.generate(present.deep_transform_keys { |k| k.to_s.camelize(:lower) })
end