Making WordPress.org

Changeset 10557


Ignore:
Timestamp:
01/07/2021 10:25:00 PM (4 years ago)
Author:
iandunn
Message:

Events: Weight country over preferred name when ordering.

See #5562.

Location:
sites/trunk/api.wordpress.org/public_html/events/1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r10555 r10557  
    370370        WHERE name = %s
    371371        ORDER BY
     372            FIELD( %s, country ) DESC,
    372373            alt ASC,
    373374            population > 0 DESC,
    374             FIELD( %s, country  ) DESC,
    375375            FIELD( %s, timezone ) DESC,
    376376            LEFT( type, 1 ) = "P" DESC,
     
    394394            WHERE name LIKE %s
    395395            ORDER BY
     396                FIELD( %s, country ) DESC,
    396397                alt ASC,
    397398                population > 0 DESC,
    398                 FIELD( %s, country  ) DESC,
    399399                FIELD( %s, timezone ) DESC,
    400400                LEFT( type, 1 ) = "P" DESC,
     
    415415    return $row;
    416416}
    417 
    418417
    419418/**
  • sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index-phpunit.php

    r10554 r10557  
    683683            ),
    684684
    685             'usa-city-altname-disambiguation-by-population' => array(
     685            'usa-city-disambiguation-by-preferred-name' => array(
    686686                'input' => array(
    687687                    'location_name' => 'Chicago',
     
    696696                ),
    697697            ),
    698             'usa-city-altname-disambiguation-by-population-2' => array(
     698            'usa-city-disambiguation-by-preferred-name-2' => array(
    699699                'input' => array(
    700700                    'location_name' => 'Chicago',
     
    707707                    'longitude'   => '-87.650',
    708708                    'country'     => 'US',
     709                ),
     710            ),
     711
     712            // Calcutta, Ohio, USA is a preferred name, but the country is more relevant here.
     713            'city-disambiguation-by-country' => array(
     714                'input' => array(
     715                    'location_name' => 'Calcutta',
     716                    'locale'        => 'hi_IN',
     717                    'timezone'      => 'Asia/Kolkata',
     718                ),
     719                'expected' => array(
     720                    'description' => 'calcutta',
     721                    'latitude'    => '22.563',
     722                    'longitude'   => '88.363',
     723                    'country'     => 'IN',
    709724                ),
    710725            ),
Note: See TracChangeset for help on using the changeset viewer.