diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-07-10 16:48:17 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-07-10 16:48:17 +0200 |
commit | 49ee28e1075f8c92b34933c934a4e1c6e37b41cd (patch) | |
tree | 44c4fdad5143c716fb5e81343b07ab0dbd3fde44 | |
parent | 62f3558ddfb60c1a6229ad0d7cc8892ff49dd5c2 (diff) | |
download | gitlab-ci-build-types.tar.gz |
Fix specsbuild-types
-rw-r--r-- | app/models/commit.rb | 16 | ||||
-rw-r--r-- | app/views/builds/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/commits/show.html.haml | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index c7584c6..eea3653 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -138,20 +138,24 @@ class Commit < ActiveRecord::Base end def builds_without_retry - return unless config_processor @builds_without_retry ||= begin - job_types = config_processor.types grouped_builds = builds.group_by(&:name) - grouped_builds = grouped_builds.map do |name, builds| + grouped_builds.map do |name, builds| builds.sort_by(&:id).last end - grouped_builds.sort_by do |build| - [job_types.index(build.job_type), build.name] - end end end + def builds_without_retry_sorted + return builds_without_retry unless config_processor + + job_types = config_processor.types + builds_without_retry.sort_by do |build| + [job_types.index(build.job_type) || -1, build.name || ""] + end + end + def retried_builds @retried_builds ||= (builds.order(id: :desc) - builds_without_retry) end diff --git a/app/views/builds/show.html.haml b/app/views/builds/show.html.haml index 5ddaa3c..55ac8af 100644 --- a/app/views/builds/show.html.haml +++ b/app/views/builds/show.html.haml @@ -10,7 +10,7 @@ #up-build-trace - if @commit.matrix? %ul.nav.nav-tabs.append-bottom-10 - - @commit.builds_without_retry.each do |build| + - @commit.builds_without_retry_sorted.each do |build| %li{class: ('active' if build == @build) } = link_to build_url(build) do %i{class: build_icon_css_class(build)} diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 5925b9d..d335754 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -75,7 +75,7 @@ - if @project.coverage_enabled? %th Coverage %th - = render @commit.builds_without_retry, controls: true + = render @commit.builds_without_retry_sorted, controls: true - if @commit.retried_builds.any? %h3 |