S
soprano
Is it possible to add rankings to an array (allowing ties):
Example (rate on points field) - convert
[
{ :name => "A", oints => 30 },
{ :name => "B", oints => 20 },
{ :name => "C", oints => 10 },
{ :name => "D", oints => 20 }
]
to
[
[1, { :name => "A", oints => 30 }],
[2, { :name => "B", oints => 20 }],
[2, { :name => "D", oints => 20 }],
[4, { :name => "C", oints => 10 }]
]
How to do this in Ruby?
Example (rate on points field) - convert
[
{ :name => "A", oints => 30 },
{ :name => "B", oints => 20 },
{ :name => "C", oints => 10 },
{ :name => "D", oints => 20 }
]
to
[
[1, { :name => "A", oints => 30 }],
[2, { :name => "B", oints => 20 }],
[2, { :name => "D", oints => 20 }],
[4, { :name => "C", oints => 10 }]
]
How to do this in Ruby?