diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 21:06:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 21:06:34 +0000 |
commit | e4c711546c693fff89b0b1c92f1b0dde927e0c84 (patch) | |
tree | 2afa79ebbb72960fd54f1392e0a18031a1d9ee54 /app/finders | |
parent | b08279013423a66f06f5edde4e067f328fe135bd (diff) | |
download | gitlab-ce-e4c711546c693fff89b0b1c92f1b0dde927e0c84.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/artifacts_finder.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/finders/artifacts_finder.rb b/app/finders/artifacts_finder.rb new file mode 100644 index 00000000000..81c5168d782 --- /dev/null +++ b/app/finders/artifacts_finder.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class ArtifactsFinder + def initialize(project, params = {}) + @project = project + @params = params + end + + def execute + artifacts = @project.job_artifacts + + sort(artifacts) + end + + private + + def sort_key + @params[:sort] || 'created_desc' + end + + def sort(artifacts) + artifacts.order_by(sort_key) + end +end |