Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php	(revision 4899)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php	(working copy)
@@ -102,6 +102,7 @@
 		$result['compatibility'] = array();
 		$result['rating'] = ( get_post_meta( $post_id, 'rating', true ) ?: 0 ) * 20; // Stored as 0.0 ~ 5.0, API outputs as 0..100
 		$result['ratings'] = array_map( 'intval', (array) get_post_meta( $post_id, 'ratings', true ) );
+		krsort( $result['ratings'] );
 		$result['num_ratings'] = array_sum( $result['ratings'] );
 		$result['support_threads'] = intval( get_post_meta( $post_id, 'support_threads', true ) );
 		$result['support_threads_resolved'] = intval( get_post_meta( $post_id, 'support_threads_resolved', true ) );
Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api.php	(revision 4899)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api.php	(working copy)
@@ -248,6 +248,7 @@
 		$this->assertObjectHasAttribute( 'rating', $plugin_info, 'Rating exists' );
 		$this->assertObjectHasAttribute( 'ratings', $plugin_info, 'Ratings exists' );
 		$this->assertAttributeInternalType( 'array', 'ratings', $plugin_info, 'Ratings should be an array' );
+		$this->assertEquals( array( 5, 4, 3, 2, 1 ), array_keys( $plugin_info->ratings ), 'Ratings should be ordered from 5 to 1' );
 		$this->assertArrayHasKey( '1', $plugin_info->ratings, 'Rating should have an attribute of 1' );
 		$this->assertArrayHasKey( '2', $plugin_info->ratings, 'Rating should have an attribute of 2' );
 		$this->assertArrayHasKey( '3', $plugin_info->ratings, 'Rating should have an attribute of 3' );
