Really fix sorting numerically for resolutions. Added tests to check it.

This commit is contained in:
Colin Kuskie 2010-08-17 13:30:39 -07:00
parent 86a190e3c6
commit 67272517ce
2 changed files with 14 additions and 2 deletions

View file

@ -278,8 +278,14 @@ sub getResolutions {
my $self = shift;
my $storage = $self->getStorageLocation;
##Filter out the web view image and thumbnail files.
my @resolutions = grep { $_ ne $self->get("filename") } @{ $storage->getFiles };
# Return a list not including the web view image.
return [ sort { $a <=> $b } grep { $_ ne $self->get("filename") } @{ $storage->getFiles } ];
@resolutions = map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { my $number = $_; $number =~ s/\.\w+$//; [ $number, $_ ] } @resolutions;
return \@resolutions;
}
#----------------------------------------------------------------------------