Module: tools Branch: master Commit: 1432ff9bcf7fa16032ad0b936064870cb8e6409a URL: https://source.winehq.org/git/tools.git/?a=commit;h=1432ff9bcf7fa16032ad0b93...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Dec 10 16:48:16 2018 +0100
testbot: Sort VMs by name if they have the same role and sort order.
This makes it possible to add all locale VMs with the same SortOrder value and still have them displayed in a meaningful order. This also allows them to retain a meaningful order even as locales are added or removed.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/lib/WineTestBot/VMs.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm index 6a08bc1..6770547 100644 --- a/testbot/lib/WineTestBot/VMs.pm +++ b/testbot/lib/WineTestBot/VMs.pm @@ -748,12 +748,14 @@ sub SortKeysBySortOrder($$) foreach my $Key (@$Keys) { my $Item = $self->GetItem($Key); - $SortOrder{$Key} = [$RoleOrders{$Item->Role} || 0, $Item->SortOrder]; + $SortOrder{$Key} = [$RoleOrders{$Item->Role} || 0, $Item->SortOrder, $Item->Name]; }
my @SortedKeys = sort { my ($soa, $sob) = ($SortOrder{$a}, $SortOrder{$b}); - return @$soa[0] <=> @$sob[0] || @$soa[1] <=> @$sob[1]; + return @$soa[0] <=> @$sob[0] || + @$soa[1] <=> @$sob[1] || + @$soa[2] cmp @$sob[2]; } @$Keys; return @SortedKeys; }