T388: Albums, playlists, and artists are now sorted alphabetically; tracks have an alphabetical sort option; and a few new indices were added.

This commit is contained in:
Peter Deltchev 2015-09-28 21:10:35 -07:00
parent aa4350596e
commit f7d128dbc5
5 changed files with 51 additions and 5 deletions

View file

@ -75,7 +75,7 @@ class AlbumsController extends ApiControllerBase
$query = Album::summary()
->with('user', 'user.avatar', 'cover')
->userDetails()
->orderBy('created_at', 'desc')
->orderBy('title', 'asc')
->where('track_count', '>', 0);
$count = $query->count();

View file

@ -167,7 +167,7 @@ class ArtistsController extends ApiControllerBase
$page = Input::get('page');
}
$query = User::orderBy('created_at', 'desc')
$query = User::orderBy('display_name', 'asc')
->where('track_count', '>', 0);
$count = $query->count();

View file

@ -46,7 +46,7 @@ class PlaylistsController extends ApiControllerBase
$query = Playlist::summary()
->with('user', 'user.avatar', 'tracks', 'tracks.cover', 'tracks.user', 'tracks.album', 'tracks.album.user')
->userDetails()
->orderBy('created_at', 'desc')
->orderBy('title', 'asc')
->where('track_count', '>', 0)
->whereIsPublic(true);

View file

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAlphabeticalIndices extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->index('display_name');
$table->index('track_count');
});
Schema::table('playlists', function (Blueprint $table) {
$table->index('title');
$table->index('track_count');
$table->index('is_public');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropIndex('users_display_name_index');
$table->dropIndex('users_track_count_index');
});
Schema::table('playlists', function (Blueprint $table) {
$table->dropIndex('playlists_title_index');
$table->dropIndex('playlists_track_count_index');
$table->dropIndex('playlists_is_public_index');
});
}
}

View file

@ -184,6 +184,7 @@ angular.module('ponyfm').factory('tracks', [
{title: 'Most Played', query: 'plays', isDefault: false, filter: 'order=play_count,desc'},
{title: 'Most Downloaded', query: 'downloads', isDefault: false, filter: 'order=download_count,desc'},
{title: 'Most Favourited', query: 'favourites', isDefault: false, filter: 'order=favourite_count,desc'}
{title: 'Alphabetical', query: 'alphabetical', isDefault: false, filter: 'order=title,asc'},
]
self.filters.genres =