Bug 7124 - Country Codes drop down not sorted by ALPHA string
: Country Codes drop down not sorted by ALPHA string
Status: CLOSED FIXED
Product: MySqueezebox.com
Classification: Unclassified
Component: Web UI
: unspecified
: PC Windows XP
: -- normal (vote)
: ---
Assigned To: Andy Grundman
http://intra.servers.slimdevices.com:...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-13 10:54 UTC by James Richardson
Modified: 2008-02-13 20:43 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Richardson 2008-02-13 10:54:27 UTC
Country Codes drop down are not sorted by ALPHA string.  It looks like they are being sorted by country code (hidden).

Suggest they get ALPHA sorted.
Comment 1 Andy Grundman 2008-02-13 10:58:43 UTC
Re-assigning to Matthew.
Comment 2 Matthew J. Martin 2008-02-13 12:21:20 UTC
this is the code doing the sorting - I don't understand what it's doing, so I'm probably not the best person to suggest a fix. 

sub getCountries : Private {
        my ( $self, $c, $default ) = @_;

        my $countries = $c->cache->get( 'countries' );

        if ( !$countries ) {
                $countries = {};
                for my $code ( Geography::Countries::code2() ) {
                        $countries->{ $code } = Geography::Countries::country( $code );
                }
                $c->cache->set( 'countries', $countries, 86400 * 7 );
        }

        # Re-sort countries
        tie my %sorted, 'Tie::IxHash';
        for my $key ( sort { $countries->{$a} cmp $countries->{$b} } keys %{$countries} ) {
                $sorted{$key} = $countries->{$key};
        }

        return \%sorted;
}
Comment 3 Andy Grundman 2008-02-13 13:28:00 UTC
Fixed in r2468, TT code was buggy.
Comment 4 James Richardson 2008-02-13 20:43:49 UTC
Verified fixed in SqueezeNetwork r2487/r17521, HW Beta (dc)