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/experiment.rb')
-rw-r--r--app/models/ml/experiment.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/ml/experiment.rb b/app/models/ml/experiment.rb
index ad6c6b7b3bf..456c23df0e0 100644
--- a/app/models/ml/experiment.rb
+++ b/app/models/ml/experiment.rb
@@ -3,6 +3,7 @@
module Ml
class Experiment < ApplicationRecord
include AtomicInternalId
+ include Sortable
PACKAGE_PREFIX = 'ml_experiment_'
@@ -15,6 +16,8 @@ module Ml
has_many :candidates, class_name: 'Ml::Candidate'
has_many :metadata, class_name: 'Ml::ExperimentMetadata'
+ scope :including_project, -> { includes(:project) }
+ scope :by_project, ->(project) { where(project: project) }
scope :with_candidate_count, -> {
left_outer_joins(:candidates)
.select("ml_experiments.*, count(ml_candidates.id) as candidate_count")