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 --- 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 6a08bc1aea..67705474e8 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; }