From 2eb0beb661cf1a97e3f36ae2785bb1ad44afd5d0 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 22 Dec 2016 14:31:42 -0600 Subject: add natural sorting token for build names --- app/models/commit_status.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 31cd381dcd2..897e53fc7bd 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 -- cgit v1.2.1