E
Eireann Kelly
This is what the hash looks like (with only 4 teams in it) ignore the
Competition:
{
'Team' => [
{
'draws' => '0',
'goal_difference' => '-1',
'wins' => '1',
'name' => 'Fulham',
'points' => '3',
'goals_conceded' => '5',
'losses' => 0,
'goals' => '4',
'games_played' => '3'
},
{
'draws' => '0',
'goal_difference' => '-9',
'wins' => 0,
'name' => 'Wolverhampton Wanderers',
'points' => '0',
'goals_conceded' => '10',
'losses' => '3',
'goals' => '1',
'games_played' => '3'
},
{
'draws' => '1',
'goal_difference' => '5',
'wins' => '2',
'name' => 'Portsmouth',
'points' => '7',
'goals_conceded' => '2',
'losses' => 0,
'goals' => '7',
'games_played' => '3'
},
{
'draws' => '0',
'goal_difference' => '6',
'wins' => '3',
'name' => 'Manchester United',
'points' => '9',
'goals_conceded' => '1',
'losses' => 0,
'goals' => '7',
'games_played' => '3'
},
],
'Competition' => [
{
'uID' => '8',
'Name' => 'English Barclaycard
Premiership',
'Season' => [
{
'uID' => '4',
'StartDate' =>
'2003-06-20 00:00:00',
'Name' => 'Season
2003/2004',
'EndDate' =>
'2004-06-19 00:00:00'
}
]
}
]
}
Ok i need to either insert a stat position which sorts on points, then
goal_difference, then goals, then goals_conceded (ascending), Or just
somehow sort the hash by those keys, using the sort function and
keeping it in that format. I've never done this before so would be
very grateful for some help.....
Competition:
{
'Team' => [
{
'draws' => '0',
'goal_difference' => '-1',
'wins' => '1',
'name' => 'Fulham',
'points' => '3',
'goals_conceded' => '5',
'losses' => 0,
'goals' => '4',
'games_played' => '3'
},
{
'draws' => '0',
'goal_difference' => '-9',
'wins' => 0,
'name' => 'Wolverhampton Wanderers',
'points' => '0',
'goals_conceded' => '10',
'losses' => '3',
'goals' => '1',
'games_played' => '3'
},
{
'draws' => '1',
'goal_difference' => '5',
'wins' => '2',
'name' => 'Portsmouth',
'points' => '7',
'goals_conceded' => '2',
'losses' => 0,
'goals' => '7',
'games_played' => '3'
},
{
'draws' => '0',
'goal_difference' => '6',
'wins' => '3',
'name' => 'Manchester United',
'points' => '9',
'goals_conceded' => '1',
'losses' => 0,
'goals' => '7',
'games_played' => '3'
},
],
'Competition' => [
{
'uID' => '8',
'Name' => 'English Barclaycard
Premiership',
'Season' => [
{
'uID' => '4',
'StartDate' =>
'2003-06-20 00:00:00',
'Name' => 'Season
2003/2004',
'EndDate' =>
'2004-06-19 00:00:00'
}
]
}
]
}
Ok i need to either insert a stat position which sorts on points, then
goal_difference, then goals, then goals_conceded (ascending), Or just
somehow sort the hash by those keys, using the sort function and
keeping it in that format. I've never done this before so would be
very grateful for some help.....