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/model.rb')
-rw-r--r--app/models/ml/model.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/ml/model.rb b/app/models/ml/model.rb
index b6f7e9a0639..1d5625ec8de 100644
--- a/app/models/ml/model.rb
+++ b/app/models/ml/model.rb
@@ -18,6 +18,7 @@ module Ml
belongs_to :project
belongs_to :user
has_many :versions, class_name: 'Ml::ModelVersion'
+ has_many :candidates, -> { without_model_version }, class_name: 'Ml::Candidate', through: :default_experiment
has_many :metadata, class_name: 'Ml::ModelMetadata'
has_one :latest_version, -> { latest_by_model }, class_name: 'Ml::ModelVersion', inverse_of: :model
@@ -31,6 +32,10 @@ module Ml
scope :by_name, ->(name) { where("ml_models.name LIKE ?", "%#{sanitize_sql_like(name)}%") } # rubocop:disable GitlabSecurity/SqlInjection
scope :by_project, ->(project) { where(project_id: project.id) }
+ def all_packages
+ Packages::MlModel::Package.where(project: project, id: versions.select(:package_id))
+ end
+
def valid_default_experiment?
return unless default_experiment