Commit 7cb3d113cb9b7f8654e1351fe67682a3dbbd808e

Authored by Andrey Karpikov
1 parent c8675202

change sorting

@@ -79,11 +79,17 @@ module Kanjai @@ -79,11 +79,17 @@ module Kanjai
79 subpart = page_template.template_parts.where(code: page_content.type_content).first 79 subpart = page_template.template_parts.where(code: page_content.type_content).first
80 if subpart 80 if subpart
81 markers_position = {} 81 markers_position = {}
  82 +
  83 + (subpart.conditions || []).sort{|a,b| a["name"] <=> b["name"] }.each do |item, index|
  84 + markers_position[item["name"]] = index
  85 + end
  86 +
82 subpart.field_options.sort_by{|item| item[:itemName].to_s }.each_with_index do |item, index| 87 subpart.field_options.sort_by{|item| item[:itemName].to_s }.each_with_index do |item, index|
83 - markers_position[item[:name]] = index + 1 88 + markers_position[item[:name]] = index + 100
84 end 89 end
  90 +
85 91
86 - return markers.sort{|a,b| (markers_position[a.marker].to_s <=> markers_position[b.marker].to_s ) } 92 + return markers.sort{|a,b| (markers_position[a.marker].to_i <=> markers_position[b.marker].to_i ) }
87 93
88 return markers 94 return markers
89 end 95 end
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.253" 2 + VERSION = "0.0.254"
3 end 3 end