Created
September 22, 2012 16:26
-
-
Save Hamcha/3766666 to your computer and use it in GitHub Desktop.
Paradise reordering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$paradise = { YOUR MEGA WORLD THING HERE } | |
$paradise.each do |p| | |
parent = p[1]["parent"] | |
if $paradise.has_key?(parent) | |
unless $paradise[parent].has_key?("childs") | |
$paradise[parent]["childs"] = Array.new | |
end | |
$paradise[parent]["childs"].push(p) | |
$paradise.delete(p) | |
end | |
end | |
print $paradise.inspect |
html = ""
vessel = Hash.new
if @vessel['parent'].to_i == 4
qr_horaire = $quest.query("SELECT Parent,id,Security FROM PHL_Paradise ORDER BY id ASC")
while row = qr_horaire.fetch_row do
vessel[row[1].to_i] = row[0].to_i
end
vessel.each do |p|
parent = p[1]["parent"].to_i
if vessel.has_key?(parent)
unless vessel[parent].has_key?("childs")
vessel[parent]["childs"] = Array.new
end
vessel[parent]["childs"].push(p)
vessel.delete(p)
end
end
puts "<pre>"
pp vessel.sort
puts "</pre>"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def mapView