Skip to content
Snippets Groups Projects
Commit 4fc27a4a authored by Gyan Gupta's avatar Gyan Gupta
Browse files

fix fileset sorting

parent deaf9862
No related tags found
1 merge request!243Fixed fileset alphanumeric sorting
Pipeline #11878 failed
class FileSetFastLoadMetadata < ActiveRecord::Base
scope :sort_and_filter_by_title_and_source, ->(work_source_identifier) {
where(work_source_identifier: work_source_identifier)
.sort_by { |item| item.file_set_title.downcase.scan(/(\d+)|(\D+)/).map { |n, s| n ? n.to_i : s } }
.sort_by { |item| item.file_set_title.downcase.gsub(/[^a-zA-Z0-9]/, '0').split(/(\d+)/).map { |s| s.match(/\d+/) ? s.to_i : s } }
}
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment