Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ml/candidate.rb')
-rw-r--r--app/models/ml/candidate.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/ml/candidate.rb b/app/models/ml/candidate.rb
index 29e1ba88528..f7da4418624 100644
--- a/app/models/ml/candidate.rb
+++ b/app/models/ml/candidate.rb
@@ -11,8 +11,15 @@ module Ml
belongs_to :user
has_many :metrics, class_name: 'Ml::CandidateMetric'
has_many :params, class_name: 'Ml::CandidateParam'
+ has_many :latest_metrics, -> { latest }, class_name: 'Ml::CandidateMetric', inverse_of: :candidate
- default_value_for(:iid) { SecureRandom.uuid }
+ attribute :iid, default: -> { SecureRandom.uuid }
+
+ scope :including_metrics_and_params, -> { includes(:latest_metrics, :params) }
+
+ def artifact_root
+ "/ml_candidate_#{iid}/-/"
+ end
class << self
def with_project_id_and_iid(project_id, iid)