diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 31cd381dcd2d0b16934d5cf717ed5bc6e4cc2cf1..897e53fc7bdc2bdb3eac8dab2f0b1c5800142353 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -137,4 +137,10 @@ class CommitStatus < ActiveRecord::Base .new(self, current_user) .fabricate! end + + def natsort_name + name.split(/(\d+)/).map do |v| + v =~ /\d+/ ? v.to_i : v + end + end end diff --git a/app/views/projects/stage/_graph.html.haml b/app/views/projects/stage/_graph.html.haml index d9d392fa02ff33d9e6566b8388ed7e1b3b33bbd6..faadcfee30c5c3218755b7eed24a9d4383a155e8 100644 --- a/app/views/projects/stage/_graph.html.haml +++ b/app/views/projects/stage/_graph.html.haml @@ -1,6 +1,6 @@ - stage = local_assigns.fetch(:stage) - statuses = stage.statuses.latest -- status_groups = statuses.sort_by(&:name).group_by(&:group_name) +- status_groups = statuses.sort_by(&:natsort_name).group_by(&:group_name) %li.stage-column .stage-name %a{ name: stage.name }