Francois Gouget : testbot/VMs: Tweak the sort order so retired and deleted VMs are last.
Alexandre Julliard
julliard at winehq.org
Thu Oct 25 13:29:48 CDT 2012
Module: tools
Branch: master
Commit: 7eb5ce4728a04a39a4203d9c6518d85ecd5cdb16
URL: http://source.winehq.org/git/tools.git/?a=commit;h=7eb5ce4728a04a39a4203d9c6518d85ecd5cdb16
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Thu Oct 25 19:14:18 2012 +0200
testbot/VMs: Tweak the sort order so retired and deleted VMs are last.
---
testbot/lib/WineTestBot/VMs.pm | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index a356e98..734a58d 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -601,20 +601,19 @@ sub SortKeysBySortOrder
my $self = shift;
my $Keys = $_[0];
+ # Sort retired and deleted VMs last
+ my %RoleOrders = ("retired" => 1, "deleted" => 2);
+
my %SortOrder;
foreach my $Key (@$Keys)
{
my $Item = $self->GetItem($Key);
- $SortOrder{$Key} = [$Item->Role, $Item->SortOrder];
+ $SortOrder{$Key} = [$RoleOrders{$Item->Role} || 0, $Item->SortOrder];
}
my @SortedKeys = sort {
my ($soa, $sob) = ($SortOrder{$a}, $SortOrder{$b});
- # Sort deleted VMs last
- return 1 if (@$soa[0] eq "deleted");
- return -1 if (@$sob[0] eq "deleted");
- # Otherwise follow the SortOrder key
- return @$soa[1] <=> @$sob[1];
+ return @$soa[0] <=> @$sob[0] || @$soa[1] <=> @$sob[1];
} @$Keys;
return \@SortedKeys;
}
More information about the wine-cvs
mailing list