Remove all non-digits before sorting by order number in finance/balancing
* Since order_number is a string, there can be more than a-zA-Z + digits Signed-off-by: bennibu <benni@dresdener27.de>
This commit is contained in:
parent
36f9bffdb8
commit
1e011256e9
1 changed files with 2 additions and 2 deletions
|
@ -34,9 +34,9 @@ class Finance::BalancingController < ApplicationController
|
|||
)
|
||||
|
||||
if params[:sort] == "order_number"
|
||||
@articles = @articles.sort { |a,b| a.article.order_number.gsub(/[a-zA-Z]/, "").to_i <=> b.article.order_number.gsub(/[a-zA-Z]/, "").to_i }
|
||||
@articles = @articles.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
||||
elsif params[:sort] == "order_number_reverse"
|
||||
@articles = @articles.sort { |a,b| b.article.order_number.gsub(/[a-zA-Z]/, "").to_i <=> a.article.order_number.gsub(/[a-zA-Z]/, "").to_i }
|
||||
@articles = @articles.sort { |a,b| b.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> a.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
||||
end
|
||||
|
||||
view = params[:view]
|
||||
|
|
Loading…
Reference in a new issue