Changeset 10554
- Timestamp:
- 01/07/2021 04:29:54 AM (4 years ago)
- 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
r10550 r10554 1 1 <?php 2 3 2 namespace Dotorg\API\Events; 4 3 use stdClass; … … 356 355 global $wpdb; 357 356 // Look for a location that matches the name. 357 // The asc ordering provides preference to the oreferred name of the locations. 358 // The population ordering provides preference to the populated areas over unpopulated/unknown. 358 359 // The FIELD() orderings give preference to rows that match the country and/or timezone, without excluding rows that don't match. 359 // And we sort by population desc, assuming that the biggest matching location is the most likely one .360 // And we sort by population desc, assuming that the biggest matching location is the most likely one within the above matching groups. 360 361 361 362 // Exact match … … 365 366 WHERE name = %s 366 367 ORDER BY 368 alt ASC, 369 population > 0 DESC, 367 370 FIELD( %s, country ) DESC, 368 371 FIELD( %s, timezone ) DESC, … … 387 390 WHERE name LIKE %s 388 391 ORDER BY 392 alt ASC, 393 population > 0 DESC, 389 394 FIELD( %s, country ) DESC, 390 395 FIELD( %s, timezone ) DESC, -
sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index-phpunit.php
r10553 r10554 594 594 'expected' => array( 595 595 'description' => 'ciudad de méxico', 596 'latitude' => '19. 428',597 'longitude' => '-99.1 28',596 'latitude' => '19.283', 597 'longitude' => '-99.133', 598 598 'country' => 'MX', 599 599 ),
Note: See TracChangeset
for help on using the changeset viewer.